AdminZone.java 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * $Header: AdminTest.java, 25/07/2005 17:15:21 luisantonioa Exp $
  3. *
  4. * $Author: luisantonioa $
  5. * $Date: 25/07/2005 17:15:21 $
  6. * $Revision: 1 $
  7. * $Log: AdminTest.java,v $
  8. * Revision 1 25/07/2005 17:15:21 luisantonioa
  9. * Added copyright notice
  10. *
  11. *
  12. * This program is free software: you can redistribute it and/or modify it under
  13. * the terms of the GNU General Public License as published by the Free Software
  14. * Foundation, either version 3 of the License, or (at your option) any later
  15. * version.
  16. *
  17. * This program is distributed in the hope that it will be useful, but WITHOUT
  18. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  19. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  20. * details.
  21. *
  22. * You should have received a copy of the GNU General Public License along with
  23. * this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. package net.sf.l2j.gameserver.handler.admincommandhandlers;
  26. import java.util.StringTokenizer;
  27. import net.sf.l2j.gameserver.datatables.MapRegionTable;
  28. import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  29. import net.sf.l2j.gameserver.instancemanager.ZoneManager;
  30. import net.sf.l2j.gameserver.model.L2Character;
  31. import net.sf.l2j.gameserver.model.Location;
  32. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  33. public class AdminZone implements IAdminCommandHandler
  34. {
  35. private static final String[] ADMIN_COMMANDS =
  36. {
  37. "admin_zone_check", "admin_zone_reload"
  38. };
  39. /* (non-Javadoc)
  40. * @see net.sf.l2j.gameserver.handler.IAdminCommandHandler#useAdminCommand(java.lang.String, net.sf.l2j.gameserver.model.L2PcInstance)
  41. */
  42. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  43. {
  44. if (activeChar == null) return false;
  45. StringTokenizer st = new StringTokenizer(command, " ");
  46. String actualCommand = st.nextToken(); // Get actual command
  47. //String val = "";
  48. //if (st.countTokens() >= 1) {val = st.nextToken();}
  49. if (actualCommand.equalsIgnoreCase("admin_zone_check"))
  50. {
  51. if (activeChar.isInsideZone(L2Character.ZONE_PVP))
  52. activeChar.sendMessage("This is a PvP zone.");
  53. else
  54. activeChar.sendMessage("This is NOT a PvP zone.");
  55. if (activeChar.isInsideZone(L2Character.ZONE_NOLANDING))
  56. activeChar.sendMessage("This is a no landing zone.");
  57. else
  58. activeChar.sendMessage("This is NOT a no landing zone.");
  59. if (activeChar.isInsideZone(L2Character.ZONE_PEACE))
  60. activeChar.sendMessage("This is a peaceful zone.");
  61. else
  62. activeChar.sendMessage("This is NOT a peaceful zone.");
  63. activeChar.sendMessage("MapRegion: x:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getX()) + " y:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getY()));
  64. activeChar.sendMessage("Closest Town: " + MapRegionTable.getInstance().getClosestTownName(activeChar));
  65. Location loc;
  66. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
  67. activeChar.sendMessage("TeleToLocation (Castle): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  68. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.ClanHall);
  69. activeChar.sendMessage("TeleToLocation (ClanHall): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  70. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.SiegeFlag);
  71. activeChar.sendMessage("TeleToLocation (SiegeFlag): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  72. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
  73. activeChar.sendMessage("TeleToLocation (Town): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  74. } else if (actualCommand.equalsIgnoreCase("admin_zone_reload"))
  75. {
  76. ZoneManager.getInstance().reload();
  77. activeChar.sendMessage("Reloading zones...");
  78. }
  79. return true;
  80. }
  81. /* (non-Javadoc)
  82. * @see net.sf.l2j.gameserver.handler.IAdminCommandHandler#getAdminCommandList()
  83. */
  84. public String[] getAdminCommandList()
  85. {
  86. return ADMIN_COMMANDS;
  87. }
  88. }