Removed pointless admin command enums.

This commit is contained in:
MobiusDevelopment
2020-02-04 16:46:39 +00:00
parent 34c709275a
commit 697efd1cfd
10 changed files with 150 additions and 344 deletions

View File

@ -54,31 +54,11 @@ public class AdminAdmin implements IAdminCommandHandler
"admin_manualhero"
};
private enum CommandEnum
{
admin_admin,
admin_admin1,
admin_admin2,
admin_admin3,
admin_admin4,
admin_gmliston,
admin_gmlistoff,
admin_silence,
admin_diet,
admin_set,
admin_set_menu,
admin_set_mod,
admin_saveolymp,
admin_manualhero
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command);
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -86,28 +66,28 @@ public class AdminAdmin implements IAdminCommandHandler
switch (comm)
{
case admin_admin:
case admin_admin1:
case admin_admin2:
case admin_admin3:
case admin_admin4:
case "admin_admin":
case "admin_admin1":
case "admin_admin2":
case "admin_admin3":
case "admin_admin4":
{
showMainPage(activeChar, command);
return true;
}
case admin_gmliston:
case "admin_gmliston":
{
AdminData.getInstance().showGm(activeChar);
BuilderUtil.sendSysMessage(activeChar, "Registerd into gm list.");
return true;
}
case admin_gmlistoff:
case "admin_gmlistoff":
{
AdminData.getInstance().hideGm(activeChar);
BuilderUtil.sendSysMessage(activeChar, "Removed from gm list.");
return true;
}
case admin_silence:
case "admin_silence":
{
if (activeChar.isInRefusalMode()) // already in message refusal mode
{
@ -121,13 +101,13 @@ public class AdminAdmin implements IAdminCommandHandler
}
return true;
}
case admin_saveolymp:
case "admin_saveolymp":
{
Olympiad.getInstance().saveOlympiadStatus();
BuilderUtil.sendSysMessage(activeChar, "Olympiad stuff saved!");
return true;
}
case admin_manualhero:
case "admin_manualhero":
{
try
{
@ -140,7 +120,7 @@ public class AdminAdmin implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Heroes formed!");
return true;
}
case admin_diet:
case "admin_diet":
{
boolean noToken = false;
if (st.hasMoreTokens())
@ -176,7 +156,7 @@ public class AdminAdmin implements IAdminCommandHandler
activeChar.refreshOverloaded();
return true;
}
case admin_set:
case "admin_set":
{
boolean noToken = false;
final String[] cmd = st.nextToken().split("_");

View File

@ -44,19 +44,11 @@ public class AdminAio implements IAdminCommandHandler
"admin_removeaio"
};
private enum CommandEnum
{
admin_setaio,
admin_removeaio
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command);
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -64,7 +56,7 @@ public class AdminAio implements IAdminCommandHandler
switch (comm)
{
case admin_setaio:
case "admin_setaio":
{
boolean noToken = false;
if (st.hasMoreTokens())
@ -121,7 +113,7 @@ public class AdminAio implements IAdminCommandHandler
}
break;
}
case admin_removeaio:
case "admin_removeaio":
{
boolean noToken = false;
if (st.hasMoreTokens())

View File

@ -52,56 +52,37 @@ public class AdminAnnouncements implements IAdminCommandHandler
"admin_autoannounce"
};
private enum CommandEnum
{
admin_list_announcements,
admin_reload_announcements,
admin_announce_announcements,
admin_add_announcement,
admin_del_announcement,
admin_announce,
admin_critannounce,
admin_announce_menu,
admin_list_autoannouncements,
admin_add_autoannouncement,
admin_del_autoannouncement,
admin_autoannounce
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command);
final String comm_s = st.nextToken();
String text = "";
int index = 0;
final CommandEnum comm = CommandEnum.valueOf(comm_s);
final String comm = st.nextToken();
if (comm == null)
{
return false;
}
String text = "";
int index = 0;
switch (comm)
{
case admin_list_announcements:
case "admin_list_announcements":
{
Announcements.getInstance().listAnnouncements(activeChar);
return true;
}
case admin_reload_announcements:
case "admin_reload_announcements":
{
Announcements.getInstance().loadAnnouncements();
Announcements.getInstance().listAnnouncements(activeChar);
return true;
}
case admin_announce_menu:
case "admin_announce_menu":
{
if (st.hasMoreTokens())
{
text = command.replace(comm_s + " ", "");
text = command.replace(comm + " ", "");
// text = st.nextToken();
}
if (!text.equals(""))
@ -111,7 +92,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
Announcements.getInstance().listAnnouncements(activeChar);
return true;
}
case admin_announce_announcements:
case "admin_announce_announcements":
{
for (PlayerInstance player : World.getInstance().getAllPlayers())
{
@ -120,11 +101,11 @@ public class AdminAnnouncements implements IAdminCommandHandler
Announcements.getInstance().listAnnouncements(activeChar);
return true;
}
case admin_add_announcement:
case "admin_add_announcement":
{
if (st.hasMoreTokens())
{
text = command.replace(comm_s + " ", "");
text = command.replace(comm + " ", "");
}
if (!text.equals(""))
{
@ -135,7 +116,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "You cannot announce Empty message");
return false;
}
case admin_del_announcement:
case "admin_del_announcement":
{
if (st.hasMoreTokens())
{
@ -158,7 +139,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //del_announcement <index> (number >=0)");
return false;
}
case admin_announce:
case "admin_announce":
{
// Call method from another class
if (Config.GM_ANNOUNCER_NAME)
@ -168,7 +149,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
Announcements.getInstance().handleAnnounce(command, 15);
return true;
}
case admin_critannounce:
case "admin_critannounce":
{
String text1 = command.substring(19);
if (Config.GM_CRITANNOUNCER_NAME && (text1.length() > 0))
@ -178,12 +159,12 @@ public class AdminAnnouncements implements IAdminCommandHandler
Broadcast.toAllOnlinePlayers(new CreatureSay(activeChar.getObjectId(), Say2.CRITICAL_ANNOUNCE, "", text1));
return true;
}
case admin_list_autoannouncements:
case "admin_list_autoannouncements":
{
AutoAnnouncementHandler.getInstance().listAutoAnnouncements(activeChar);
return true;
}
case admin_add_autoannouncement:
case "admin_add_autoannouncement":
{
if (st.hasMoreTokens())
{
@ -219,7 +200,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //add_autoannouncement <delay> (Seconds > 30) <Announcements>");
return false;
}
case admin_del_autoannouncement:
case "admin_del_autoannouncement":
{
if (st.hasMoreTokens())
{
@ -250,7 +231,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
}
return false;
}
case admin_autoannounce:
case "admin_autoannounce":
{
AutoAnnouncementHandler.getInstance().listAutoAnnouncements(activeChar);
return true;

View File

@ -40,21 +40,11 @@ public class AdminBuffs implements IAdminCommandHandler
"admin_areacancel"
};
private enum CommandEnum
{
admin_getbuffs,
admin_stopbuff,
admin_stopallbuffs,
admin_areacancel
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command, " ");
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -62,7 +52,7 @@ public class AdminBuffs implements IAdminCommandHandler
switch (comm)
{
case admin_getbuffs:
case "admin_getbuffs":
{
if (st.hasMoreTokens())
{
@ -87,7 +77,7 @@ public class AdminBuffs implements IAdminCommandHandler
return true;
}
}
case admin_stopbuff:
case "admin_stopbuff":
{
if (st.hasMoreTokens())
{
@ -121,7 +111,7 @@ public class AdminBuffs implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //stopbuff <playername> [skillId]");
return false;
}
case admin_stopallbuffs:
case "admin_stopallbuffs":
{
if (st.hasMoreTokens())
{
@ -137,7 +127,7 @@ public class AdminBuffs implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //stopallbuffs <playername>");
return false;
}
case admin_areacancel:
case "admin_areacancel":
{
if (st.hasMoreTokens())
{

View File

@ -69,53 +69,11 @@ public class AdminCTFEngine implements IAdminCommandHandler
"admin_ctf_interval"
};
private enum CommandEnum
{
admin_ctf,
admin_ctf_name,
admin_ctf_desc,
admin_ctf_join_loc,
admin_ctf_edit,
admin_ctf_control,
admin_ctf_minlvl,
admin_ctf_maxlvl,
admin_ctf_tele_npc,
admin_ctf_tele_team,
admin_ctf_tele_flag,
admin_ctf_npc,
admin_ctf_npc_pos,
admin_ctf_reward,
admin_ctf_reward_amount,
admin_ctf_team_add,
admin_ctf_team_remove,
admin_ctf_team_pos,
admin_ctf_team_color,
admin_ctf_team_flag,
admin_ctf_join,
admin_ctf_teleport,
admin_ctf_start,
admin_ctf_startevent,
admin_ctf_abort,
admin_ctf_finish,
admin_ctf_sit,
admin_ctf_dump,
admin_ctf_save,
admin_ctf_load,
admin_ctf_jointime,
admin_ctf_eventtime,
admin_ctf_autoevent,
admin_ctf_minplayers,
admin_ctf_maxplayers,
admin_ctf_interval
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command);
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -123,12 +81,12 @@ public class AdminCTFEngine implements IAdminCommandHandler
switch (comm)
{
case admin_ctf:
case "admin_ctf":
{
showMainPage(activeChar);
return true;
}
case admin_ctf_name:
case "admin_ctf_name":
{
if (st.hasMoreTokens())
{
@ -143,7 +101,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_name <event_name>");
return false;
}
case admin_ctf_desc:
case "admin_ctf_desc":
{
if (st.hasMoreTokens())
{
@ -158,7 +116,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_desc <event_descr>");
return false;
}
case admin_ctf_join_loc:
case "admin_ctf_join_loc":
{
if (st.hasMoreTokens())
{
@ -173,17 +131,17 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_join_loc <event_loc_name>");
return false;
}
case admin_ctf_edit:
case "admin_ctf_edit":
{
showEditPage(activeChar);
return true;
}
case admin_ctf_control:
case "admin_ctf_control":
{
showControlPage(activeChar);
return true;
}
case admin_ctf_minlvl:
case "admin_ctf_minlvl":
{
if (st.hasMoreTokens())
{
@ -214,7 +172,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_minlvl <min_lvl_value>");
return false;
}
case admin_ctf_maxlvl:
case "admin_ctf_maxlvl":
{
if (st.hasMoreTokens())
{
@ -245,13 +203,13 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_maxlvl <min_lvl_value>");
return false;
}
case admin_ctf_tele_npc:
case "admin_ctf_tele_npc":
{
activeChar.teleToLocation(CTF.getNpcLocation(), false);
showMainPage(activeChar);
return false;
}
case admin_ctf_tele_team:
case "admin_ctf_tele_team":
{
if (st.hasMoreTokens())
{
@ -271,7 +229,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_tele_team <team_name>");
return false;
}
case admin_ctf_tele_flag:
case "admin_ctf_tele_flag":
{
if (st.hasMoreTokens())
{
@ -291,7 +249,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_tele_flag <team_name>");
return false;
}
case admin_ctf_npc:
case "admin_ctf_npc":
{
if (st.hasMoreTokens())
{
@ -316,13 +274,13 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_npc <npc_id>");
return false;
}
case admin_ctf_npc_pos:
case "admin_ctf_npc_pos":
{
CTF.setNpcPos(activeChar);
showMainPage(activeChar);
return true;
}
case admin_ctf_reward:
case "admin_ctf_reward":
{
if (st.hasMoreTokens())
{
@ -347,7 +305,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_reward <reward_id>");
return false;
}
case admin_ctf_reward_amount:
case "admin_ctf_reward_amount":
{
if (st.hasMoreTokens())
{
@ -372,7 +330,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_reward_amount <reward_amount>");
return false;
}
case admin_ctf_team_add:
case "admin_ctf_team_add":
{
if (st.hasMoreTokens())
{
@ -383,7 +341,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_team_add <team_name>");
return false;
}
case admin_ctf_team_remove:
case "admin_ctf_team_remove":
{
if (st.hasMoreTokens())
{
@ -394,7 +352,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_team_remove <team_name>");
return false;
}
case admin_ctf_team_pos:
case "admin_ctf_team_pos":
{
if (st.hasMoreTokens())
{
@ -405,7 +363,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_team_pos <team_name>");
return false;
}
case admin_ctf_team_color:
case "admin_ctf_team_color":
{
if (st.countTokens() == 2)
{
@ -428,7 +386,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_team_color <colorHex> <teamName>");
return false;
}
case admin_ctf_team_flag:
case "admin_ctf_team_flag":
{
if (st.hasMoreTokens())
{
@ -439,7 +397,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_team_flag <teamName>");
return false;
}
case admin_ctf_join:
case "admin_ctf_join":
{
if (CTF.startJoin())
{
@ -449,13 +407,13 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Cannot startJoin, check LOGGER for info..");
return false;
}
case admin_ctf_teleport:
case "admin_ctf_teleport":
{
CTF.startTeleport();
showMainPage(activeChar);
return true;
}
case admin_ctf_start:
case "admin_ctf_start":
{
if (CTF.startEvent())
{
@ -465,49 +423,49 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Cannot startEvent, check LOGGER for info..");
return false;
}
case admin_ctf_startevent:
case "admin_ctf_startevent":
{
CTF.eventOnceStart();
showMainPage(activeChar);
return true;
}
case admin_ctf_abort:
case "admin_ctf_abort":
{
BuilderUtil.sendSysMessage(activeChar, "Aborting event");
CTF.abortEvent();
showMainPage(activeChar);
return true;
}
case admin_ctf_finish:
case "admin_ctf_finish":
{
CTF.finishEvent();
showMainPage(activeChar);
return true;
}
case admin_ctf_sit:
case "admin_ctf_sit":
{
CTF.sit();
showMainPage(activeChar);
return true;
}
case admin_ctf_dump:
case "admin_ctf_dump":
{
CTF.dumpData();
return true;
}
case admin_ctf_save:
case "admin_ctf_save":
{
CTF.saveData();
showMainPage(activeChar);
return true;
}
case admin_ctf_load:
case "admin_ctf_load":
{
CTF.loadData();
showMainPage(activeChar);
return true;
}
case admin_ctf_jointime:
case "admin_ctf_jointime":
{
if (st.hasMoreTokens())
{
@ -533,7 +491,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_jointime <minutes>");
return false;
}
case admin_ctf_eventtime:
case "admin_ctf_eventtime":
{
if (st.hasMoreTokens())
{
@ -559,7 +517,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_eventtime <minutes>");
return false;
}
case admin_ctf_autoevent:
case "admin_ctf_autoevent":
{
if ((CTF.getJoinTime() > 0) && (CTF.getEventTime() > 0))
{
@ -570,7 +528,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, times not defined");
return false;
}
case admin_ctf_interval:
case "admin_ctf_interval":
{
if (st.hasMoreTokens())
{
@ -596,7 +554,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_interval <minutes>");
return false;
}
case admin_ctf_minplayers:
case "admin_ctf_minplayers":
{
if (st.hasMoreTokens())
{
@ -622,7 +580,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_minplayers <number>");
return false;
}
case admin_ctf_maxplayers:
case "admin_ctf_maxplayers":
{
if (st.hasMoreTokens())
{

View File

@ -42,24 +42,11 @@ public class AdminCache implements IAdminCommandHandler
"admin_cache_crest_fix"
};
private enum CommandEnum
{
admin_cache_htm_rebuild,
admin_cache_htm_reload,
admin_cache_reload_path,
admin_cache_reload_file,
admin_cache_crest_rebuild,
admin_cache_crest_reload,
admin_cache_crest_fix
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command, " ");
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -67,14 +54,14 @@ public class AdminCache implements IAdminCommandHandler
switch (comm)
{
case admin_cache_htm_reload:
case admin_cache_htm_rebuild:
case "admin_cache_htm_reload":
case "admin_cache_htm_rebuild":
{
HtmCache.getInstance().reload(Config.DATAPACK_ROOT);
BuilderUtil.sendSysMessage(activeChar, "Cache[HTML]: " + HtmCache.getInstance().getMemoryUsage() + " MB on " + HtmCache.getInstance().getLoadedFiles() + " file(s) loaded.");
return true;
}
case admin_cache_reload_path:
case "admin_cache_reload_path":
{
if (st.hasMoreTokens())
{
@ -86,7 +73,7 @@ public class AdminCache implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //cache_reload_path <path>");
return false;
}
case admin_cache_reload_file:
case "admin_cache_reload_file":
{
if (st.hasMoreTokens())
{
@ -104,14 +91,14 @@ public class AdminCache implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //cache_reload_file <relative_path/file>");
return false;
}
case admin_cache_crest_rebuild:
case admin_cache_crest_reload:
case "admin_cache_crest_rebuild":
case "admin_cache_crest_reload":
{
CrestCache.getInstance().reload();
BuilderUtil.sendSysMessage(activeChar, "Cache[Crest]: " + String.format("%.3f", CrestCache.getInstance().getMemoryUsage()) + " megabytes on " + CrestCache.getInstance().getLoadedFiles() + " files loaded");
return true;
}
case admin_cache_crest_fix:
case "admin_cache_crest_fix":
{
CrestCache.getInstance().convertOldPedgeFiles();
BuilderUtil.sendSysMessage(activeChar, "Cache[Crest]: crests fixed");

View File

@ -46,20 +46,11 @@ public class AdminCreateItem implements IAdminCommandHandler
"admin_create_coin"
};
private enum CommandEnum
{
admin_itemcreate,
admin_create_item,
admin_mass_create,
admin_create_coin
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command);
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -67,12 +58,12 @@ public class AdminCreateItem implements IAdminCommandHandler
switch (comm)
{
case admin_itemcreate:
case "admin_itemcreate":
{
AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm");
return true;
}
case admin_create_item:
case "admin_create_item":
{
if (st.hasMoreTokens())
{
@ -129,7 +120,7 @@ public class AdminCreateItem implements IAdminCommandHandler
}
return false;
}
case admin_mass_create:
case "admin_mass_create":
{
if (st.hasMoreTokens())
{
@ -181,7 +172,7 @@ public class AdminCreateItem implements IAdminCommandHandler
}
return false;
}
case admin_create_coin:
case "admin_create_coin":
{
try
{
@ -193,6 +184,7 @@ public class AdminCreateItem implements IAdminCommandHandler
}
createItem(activeChar, id, (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 1);
AdminHelpPage.showHelpPage(activeChar, "itemcreation.htm");
}
catch (Exception e)
{

View File

@ -89,45 +89,11 @@ public class AdminEditChar implements IAdminCommandHandler
"admin_sethero"
};
private enum CommandEnum
{
admin_changename, // changes char name
admin_setname, // changes char name
admin_edit_character,
admin_current_player,
admin_nokarma,
admin_setkarma,
admin_character_list, // same as character_info, kept for compatibility purposes
admin_character_info, // given a player name, displays an information window
admin_show_characters,
admin_find_character,
admin_find_dualbox,
admin_find_ip, // find all the player connections from a given IPv4 number
admin_find_account, // list all the characters from an account (useful for GMs w/o DB access)
admin_save_modifications, // consider it deprecated...
admin_rec,
admin_setclass,
admin_settitle,
admin_setsex,
admin_setcolor,
admin_fullfood,
admin_remclanwait,
admin_setcp,
admin_sethp,
admin_setmp,
admin_setchar_cp,
admin_setchar_hp,
admin_setchar_mp,
admin_sethero
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command);
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -135,8 +101,8 @@ public class AdminEditChar implements IAdminCommandHandler
switch (comm)
{
case admin_changename:
case admin_setname:
case "admin_changename":
case "admin_setname":
{
String val = "";
if (st.hasMoreTokens())
@ -206,22 +172,22 @@ public class AdminEditChar implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Name changed from " + oldName + " to " + val);
return true;
} // changes char name
case admin_edit_character:
case "admin_edit_character":
{
editCharacter(activeChar);
return true;
}
case admin_current_player:
case "admin_current_player":
{
showCharacterInfo(activeChar, null);
return true;
}
case admin_nokarma:
case "admin_nokarma":
{
setTargetKarma(activeChar, 0);
return true;
}
case admin_setkarma:
case "admin_setkarma":
{
int karma = 0;
if (st.hasMoreTokens())
@ -245,8 +211,8 @@ public class AdminEditChar implements IAdminCommandHandler
setTargetKarma(activeChar, karma);
return true;
}
case admin_character_list:
case admin_character_info:
case "admin_character_list":
case "admin_character_info":
{
String val = "";
if (st.hasMoreTokens())
@ -277,7 +243,7 @@ public class AdminEditChar implements IAdminCommandHandler
activeChar.sendPacket(SystemMessageId.CHARACTER_DOES_NOT_EXIST);
return false;
}
case admin_show_characters:
case "admin_show_characters":
{
String val = "";
if (st.hasMoreTokens())
@ -300,7 +266,7 @@ public class AdminEditChar implements IAdminCommandHandler
listCharacters(activeChar, 0);
return false;
}
case admin_find_character:
case "admin_find_character":
{
String val = "";
if (st.hasMoreTokens())
@ -326,7 +292,7 @@ public class AdminEditChar implements IAdminCommandHandler
findCharacter(activeChar, val);
return true;
}
case admin_find_dualbox:
case "admin_find_dualbox":
{
String val = "";
int boxes = 2;
@ -347,7 +313,7 @@ public class AdminEditChar implements IAdminCommandHandler
findMultibox(activeChar, boxes);
return true;
}
case admin_find_ip:
case "admin_find_ip":
{
String val = "";
if (st.hasMoreTokens())
@ -372,7 +338,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
return true;
}
case admin_find_account:
case "admin_find_account":
{
String val = "";
if (st.hasMoreTokens())
@ -388,7 +354,7 @@ public class AdminEditChar implements IAdminCommandHandler
findCharactersPerAccount(activeChar, val);
return true;
}
case admin_save_modifications:
case "admin_save_modifications":
{
String val = "";
if (st.hasMoreTokens())
@ -414,7 +380,7 @@ public class AdminEditChar implements IAdminCommandHandler
adminModifyCharacter(activeChar, val);
return true;
}
case admin_rec:
case "admin_rec":
{
String val = "";
int value = 1;
@ -455,7 +421,7 @@ public class AdminEditChar implements IAdminCommandHandler
player.broadcastUserInfo();
return true;
}
case admin_setclass:
case "admin_setclass":
{
String val = "";
int classidval = 0;
@ -516,7 +482,7 @@ public class AdminEditChar implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //setclass <valid_new_classid>");
return false;
}
case admin_settitle:
case "admin_settitle":
{
String val = "";
if (st.hasMoreTokens())
@ -574,7 +540,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
return true;
}
case admin_setsex:
case "admin_setsex":
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
@ -602,7 +568,7 @@ public class AdminEditChar implements IAdminCommandHandler
player.broadcastUserInfo();
return true;
}
case admin_setcolor:
case "admin_setcolor":
{
String val = "";
if (st.hasMoreTokens())
@ -631,7 +597,7 @@ public class AdminEditChar implements IAdminCommandHandler
player.broadcastUserInfo();
return true;
}
case admin_fullfood:
case "admin_fullfood":
{
final WorldObject target = activeChar.getTarget();
if (target instanceof PetInstance)
@ -647,7 +613,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
return true;
}
case admin_remclanwait:
case "admin_remclanwait":
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
@ -673,7 +639,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
return true;
}
case admin_setcp:
case "admin_setcp":
{
String val = "";
int value = 0;
@ -699,7 +665,7 @@ public class AdminEditChar implements IAdminCommandHandler
activeChar.getStatus().setCurrentCp(value);
return true;
}
case admin_sethp:
case "admin_sethp":
{
String val = "";
int value = 0;
@ -725,7 +691,7 @@ public class AdminEditChar implements IAdminCommandHandler
activeChar.getStatus().setCurrentHp(value);
return true;
}
case admin_setmp:
case "admin_setmp":
{
String val = "";
int value = 0;
@ -751,7 +717,7 @@ public class AdminEditChar implements IAdminCommandHandler
activeChar.getStatus().setCurrentMp(value);
return true;
}
case admin_setchar_cp:
case "admin_setchar_cp":
{
String val = "";
int value = 0;
@ -790,7 +756,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
return true;
}
case admin_setchar_hp:
case "admin_setchar_hp":
{
String val = "";
int value = 0;
@ -829,7 +795,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
return true;
}
case admin_setchar_mp:
case "admin_setchar_mp":
{
String val = "";
int value = 0;
@ -868,7 +834,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
return true;
}
case admin_sethero:
case "admin_sethero":
{
try
{
@ -999,11 +965,6 @@ public class AdminEditChar implements IAdminCommandHandler
activeChar.sendPacket(adminReply);
}
/**
* @param activeChar
* @param player
* @param filename
*/
public static void gatherCharacterInfo(PlayerInstance activeChar, PlayerInstance player, String filename)
{
String ip = "N/A";

View File

@ -39,22 +39,11 @@ public class AdminPetition implements IAdminCommandHandler
"admin_reset_petitions"
};
private enum CommandEnum
{
admin_view_petitions,
admin_view_petition,
admin_accept_petition,
admin_reject_petition,
admin_reset_petitions
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(command);
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
@ -62,12 +51,12 @@ public class AdminPetition implements IAdminCommandHandler
switch (comm)
{
case admin_view_petitions:
case "admin_view_petitions":
{
PetitionManager.getInstance().sendPendingPetitionList(activeChar);
return true;
}
case admin_view_petition:
case "admin_view_petition":
{
int petitionId = -1;
if (st.hasMoreTokens())
@ -85,7 +74,7 @@ public class AdminPetition implements IAdminCommandHandler
PetitionManager.getInstance().viewPetition(activeChar, petitionId);
return true;
}
case admin_accept_petition:
case "admin_accept_petition":
{
if (PetitionManager.getInstance().isPlayerInConsultation(activeChar))
{
@ -117,7 +106,7 @@ public class AdminPetition implements IAdminCommandHandler
}
return true;
}
case admin_reject_petition:
case "admin_reject_petition":
{
int petitionId = -1;
if (st.hasMoreTokens())
@ -139,7 +128,7 @@ public class AdminPetition implements IAdminCommandHandler
}
return true;
}
case admin_reset_petitions:
case "admin_reset_petitions":
{
if (PetitionManager.getInstance().isPetitionInProcess())
{

View File

@ -71,36 +71,16 @@ public class AdminTeleport implements IAdminCommandHandler
"admin_recall_party",
};
private enum CommandEnum
{
admin_show_moves,
admin_show_moves_other,
admin_show_teleport,
admin_teleport_to_character,
admin_teleportto,
admin_move_to,
admin_teleport_character,
admin_recall,
admin_walk,
admin_recall_npc,
admin_gonorth,
admin_gosouth,
admin_goeast,
admin_gowest,
admin_goup,
admin_godown,
admin_instant_move,
admin_sendhome,
admin_tele,
admin_teleto,
admin_recall_party
}
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
StringTokenizer st = new StringTokenizer(command);
final CommandEnum comm = CommandEnum.valueOf(st.nextToken());
final String comm = st.nextToken();
if (comm == null)
{
return false;
}
// Alt+g window (instant move)
if (command.equals("admin_instant_move"))
{
@ -135,34 +115,30 @@ public class AdminTeleport implements IAdminCommandHandler
{
}
}
else if (comm == null)
{
return false;
}
switch (comm)
{
case admin_show_moves:
case "admin_show_moves":
{
AdminHelpPage.showHelpPage(activeChar, "teleports.htm");
return true;
}
case admin_show_moves_other:
case "admin_show_moves_other":
{
AdminHelpPage.showHelpPage(activeChar, "tele/other.html");
return true;
}
case admin_show_teleport:
case "admin_show_teleport":
{
showTeleportCharWindow(activeChar);
return true;
}
case admin_teleport_to_character:
case "admin_teleport_to_character":
{
teleportToCharacter(activeChar, activeChar.getTarget());
return true;
}
case admin_teleportto:
case "admin_teleportto":
{
String val = "";
if (st.hasMoreTokens())
@ -184,7 +160,7 @@ public class AdminTeleport implements IAdminCommandHandler
teleportToCharacter(activeChar, player);
return true;
}
case admin_recall_party:
case "admin_recall_party":
{
if (activeChar.isGM() && (activeChar.getAccessLevel().getLevel() != 100))
{
@ -231,7 +207,7 @@ public class AdminTeleport implements IAdminCommandHandler
}
return true;
}
case admin_move_to:
case "admin_move_to":
{
int x = 0;
int y = 0;
@ -268,7 +244,7 @@ public class AdminTeleport implements IAdminCommandHandler
teleportTo(activeChar, x, y, z);
return true;
}
case admin_teleport_character:
case "admin_teleport_character":
{
int x = 0;
int y = 0;
@ -320,7 +296,7 @@ public class AdminTeleport implements IAdminCommandHandler
teleportTo(player, x, y, z);
return true;
}
case admin_recall:
case "admin_recall":
{
String val = "";
if (st.hasMoreTokens())
@ -347,7 +323,7 @@ public class AdminTeleport implements IAdminCommandHandler
teleportTo(player, activeChar.getX(), activeChar.getY(), activeChar.getZ());
return true;
}
case admin_walk:
case "admin_walk":
{
int x = 0;
int y = 0;
@ -383,17 +359,17 @@ public class AdminTeleport implements IAdminCommandHandler
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, pos);
return true;
}
case admin_recall_npc:
case "admin_recall_npc":
{
recallNPC(activeChar);
break;
}
case admin_gonorth:
case admin_gosouth:
case admin_goeast:
case admin_gowest:
case admin_goup:
case admin_godown:
case "admin_gonorth":
case "admin_gosouth":
case "admin_goeast":
case "admin_gowest":
case "admin_goup":
case "admin_godown":
{
int intVal = 150;
int x = activeChar.getX();
@ -453,12 +429,12 @@ public class AdminTeleport implements IAdminCommandHandler
return false;
}
}
case admin_tele:
case "admin_tele":
{
showTeleportWindow(activeChar);
break;
}
case admin_teleto:
case "admin_teleto":
{
String val = "";
if (st.hasMoreTokens())