123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- /*
- * $Header: AdminTest.java, 25/07/2005 17:15:21 luisantonioa Exp $
- *
- * $Author: luisantonioa $
- * $Date: 25/07/2005 17:15:21 $
- * $Revision: 1 $
- * $Log: AdminTest.java,v $
- * Revision 1 25/07/2005 17:15:21 luisantonioa
- * Added copyright notice
- *
- *
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package net.sf.l2j.gameserver.handler.admincommandhandlers;
- import java.util.NoSuchElementException;
- import java.util.StringTokenizer;
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.ThreadPoolManager;
- import net.sf.l2j.gameserver.Universe;
- import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- import net.sf.l2j.gameserver.model.L2Character;
- import net.sf.l2j.gameserver.model.L2Object;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.serverpackets.MagicSkillUse;
- /**
- * This class ...
- *
- * @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
- */
- public class AdminTest implements IAdminCommandHandler
- {
- private static final String[] ADMIN_COMMANDS =
- {
- "admin_test", "admin_stats", "admin_skill_test",
- "admin_st", "admin_mp", "admin_known"
- };
- /* (non-Javadoc)
- * @see net.sf.l2j.gameserver.handler.IAdminCommandHandler#useAdminCommand(java.lang.String, net.sf.l2j.gameserver.model.L2PcInstance)
- */
- public boolean useAdminCommand(String command, L2PcInstance activeChar)
- {
- if (command.equals("admin_stats"))
- {
- for (String line : ThreadPoolManager.getInstance().getStats())
- {
- activeChar.sendMessage(line);
- }
- }
- else if (command.startsWith("admin_skill_test") || command.startsWith("admin_st"))
- {
- try
- {
- StringTokenizer st = new StringTokenizer(command);
- st.nextToken();
- int id = Integer.parseInt(st.nextToken());
- adminTestSkill(activeChar,id);
- }
- catch(NumberFormatException e)
- {
- activeChar.sendMessage("Command format is //skill_test <ID>");
- }
- catch(NoSuchElementException nsee)
- {
- activeChar.sendMessage("Command format is //skill_test <ID>");
- }
- }
- else if (command.startsWith("admin_test uni flush"))
- {
- Universe.getInstance().flush();
- activeChar.sendMessage("Universe Map Saved.");
- }
- else if (command.startsWith("admin_test uni"))
- {
- activeChar.sendMessage("Universe Map Size is: "+Universe.getInstance().size());
- }
- else if (command.equals("admin_mp on"))
- {
- //.startPacketMonitor();
- activeChar.sendMessage("command not working");
- }
- else if (command.equals("admin_mp off"))
- {
- //.stopPacketMonitor();
- activeChar.sendMessage("command not working");
- }
- else if (command.equals("admin_mp dump"))
- {
- //.dumpPacketHistory();
- activeChar.sendMessage("command not working");
- }
- else if (command.equals("admin_known on"))
- {
- Config.CHECK_KNOWN = true;
- }
- else if (command.equals("admin_known off"))
- {
- Config.CHECK_KNOWN = false;
- }
- return true;
- }
- /**
- * @param activeChar
- * @param id
- */
- private void adminTestSkill(L2PcInstance activeChar, int id)
- {
- L2Character player;
- L2Object target = activeChar.getTarget();
- if(!(target instanceof L2Character))
- player = activeChar;
- else
- player = (L2Character)target;
- player.broadcastPacket(new MagicSkillUse(activeChar, player, id, 1, 1, 1));
- }
- /* (non-Javadoc)
- * @see net.sf.l2j.gameserver.handler.IAdminCommandHandler#getAdminCommandList()
- */
- public String[] getAdminCommandList()
- {
- return ADMIN_COMMANDS;
- }
- }
|