AdminZone.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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",
  38. "admin_zone_reload"
  39. };
  40. /**
  41. *
  42. * @see net.sf.l2j.gameserver.handler.IAdminCommandHandler#useAdminCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
  43. */
  44. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  45. {
  46. if (activeChar == null)
  47. return false;
  48. StringTokenizer st = new StringTokenizer(command, " ");
  49. String actualCommand = st.nextToken(); // Get actual command
  50. //String val = "";
  51. //if (st.countTokens() >= 1) {val = st.nextToken();}
  52. if (actualCommand.equalsIgnoreCase("admin_zone_check"))
  53. {
  54. if (activeChar.isInsideZone(L2Character.ZONE_PVP))
  55. activeChar.sendMessage("This is a PvP zone.");
  56. else
  57. activeChar.sendMessage("This is NOT a PvP zone.");
  58. if (activeChar.isInsideZone(L2Character.ZONE_NOLANDING))
  59. activeChar.sendMessage("This is a no landing zone.");
  60. else
  61. activeChar.sendMessage("This is NOT a no landing zone.");
  62. if (activeChar.isInsideZone(L2Character.ZONE_PEACE))
  63. activeChar.sendMessage("This is a peaceful zone.");
  64. else
  65. activeChar.sendMessage("This is NOT a peaceful zone.");
  66. activeChar.sendMessage("MapRegion: x:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getX()) + " y:" + MapRegionTable.getInstance().getMapRegionX(activeChar.getY()));
  67. activeChar.sendMessage("Closest Town: " + MapRegionTable.getInstance().getClosestTownName(activeChar));
  68. Location loc;
  69. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Castle);
  70. activeChar.sendMessage("TeleToLocation (Castle): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  71. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.ClanHall);
  72. activeChar.sendMessage("TeleToLocation (ClanHall): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  73. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.SiegeFlag);
  74. activeChar.sendMessage("TeleToLocation (SiegeFlag): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  75. loc = MapRegionTable.getInstance().getTeleToLocation(activeChar, MapRegionTable.TeleportWhereType.Town);
  76. activeChar.sendMessage("TeleToLocation (Town): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
  77. }
  78. else if (actualCommand.equalsIgnoreCase("admin_zone_reload"))
  79. {
  80. ZoneManager.getInstance().reload();
  81. activeChar.sendMessage("Reloading zones...");
  82. }
  83. return true;
  84. }
  85. /**
  86. *
  87. * @see net.sf.l2j.gameserver.handler.IAdminCommandHandler#getAdminCommandList()
  88. */
  89. public String[] getAdminCommandList()
  90. {
  91. return ADMIN_COMMANDS;
  92. }
  93. }