AdminGm.java 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package handlers.admincommandhandlers;
  16. import java.util.logging.Logger;
  17. import com.l2jserver.gameserver.datatables.AdminTable;
  18. import com.l2jserver.gameserver.handler.IAdminCommandHandler;
  19. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  20. /**
  21. * This class handles following admin commands:
  22. * - gm = turns gm mode off
  23. *
  24. * @version $Revision: 1.2.4.4 $ $Date: 2005/04/11 10:06:06 $
  25. */
  26. public class AdminGm implements IAdminCommandHandler
  27. {
  28. private static Logger _log = Logger.getLogger(AdminGm.class.getName());
  29. private static final String[] ADMIN_COMMANDS =
  30. {
  31. "admin_gm"
  32. };
  33. @Override
  34. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  35. {
  36. if (command.equals("admin_gm") && activeChar.isGM())
  37. {
  38. AdminTable.getInstance().deleteGm(activeChar);
  39. activeChar.setAccessLevel(0);
  40. activeChar.sendMessage("You no longer have GM status.");
  41. _log.info("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") turned his GM status off");
  42. }
  43. return true;
  44. }
  45. @Override
  46. public String[] getAdminCommandList()
  47. {
  48. return ADMIN_COMMANDS;
  49. }
  50. }