AdminUnblockIp.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package handlers.admincommandhandlers;
  20. import java.util.logging.Logger;
  21. import com.l2jserver.gameserver.handler.IAdminCommandHandler;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. /**
  24. * This class handles following admin commands:
  25. * <ul>
  26. * <li>admin_unblockip</li>
  27. * </ul>
  28. * @version $Revision: 1.3.2.6.2.4 $ $Date: 2005/04/11 10:06:06 $
  29. */
  30. public class AdminUnblockIp implements IAdminCommandHandler
  31. {
  32. private static final Logger _log = Logger.getLogger(AdminUnblockIp.class.getName());
  33. private static final String[] ADMIN_COMMANDS =
  34. {
  35. "admin_unblockip"
  36. };
  37. @Override
  38. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  39. {
  40. if (command.startsWith("admin_unblockip "))
  41. {
  42. try
  43. {
  44. String ipAddress = command.substring(16);
  45. if (unblockIp(ipAddress, activeChar))
  46. {
  47. activeChar.sendMessage("Removed IP " + ipAddress + " from blocklist!");
  48. }
  49. }
  50. catch (StringIndexOutOfBoundsException e)
  51. {
  52. activeChar.sendMessage("Usage: //unblockip <ip>");
  53. }
  54. }
  55. return true;
  56. }
  57. @Override
  58. public String[] getAdminCommandList()
  59. {
  60. return ADMIN_COMMANDS;
  61. }
  62. private boolean unblockIp(String ipAddress, L2PcInstance activeChar)
  63. {
  64. // LoginServerThread.getInstance().unBlockip(ipAddress);
  65. _log.warning("IP removed by GM " + activeChar.getName());
  66. return true;
  67. }
  68. }