AdminPathNode.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 net.sf.l2j.gameserver.handler.admincommandhandlers;
  16. import java.util.List;
  17. import net.sf.l2j.Config;
  18. import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  19. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  20. import net.sf.l2j.gameserver.pathfinding.AbstractNodeLoc;
  21. import net.sf.l2j.gameserver.pathfinding.PathFinding;
  22. public class AdminPathNode implements IAdminCommandHandler
  23. {
  24. private static final String[] ADMIN_COMMANDS =
  25. {
  26. "admin_pn_info",
  27. "admin_show_path",
  28. "admin_path_debug",
  29. "admin_show_pn",
  30. "admin_find_path",
  31. };
  32. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  33. {
  34. if (command.equals("admin_pn_info"))
  35. {
  36. }
  37. else if (command.equals("admin_show_path"))
  38. {
  39. }
  40. else if (command.equals("admin_path_debug"))
  41. {
  42. }
  43. else if (command.equals("admin_show_pn"))
  44. {
  45. }
  46. else if (command.equals("admin_find_path"))
  47. {
  48. if (Config.GEODATA < 2)
  49. {
  50. activeChar.sendMessage("PathFinding has not been enabled.");
  51. return true;
  52. }
  53. if (activeChar.getTarget() != null)
  54. {
  55. List<AbstractNodeLoc> path = PathFinding.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ());
  56. if (path == null)
  57. {
  58. activeChar.sendMessage("No Route!");
  59. return true;
  60. }
  61. for (AbstractNodeLoc a : path)
  62. {
  63. activeChar.sendMessage("x:" + a.getX() + " y:" + a.getY() + " z:" + a.getZ());
  64. }
  65. }
  66. else
  67. activeChar.sendMessage("No Target!");
  68. }
  69. return true;
  70. }
  71. public String[] getAdminCommandList()
  72. {
  73. return ADMIN_COMMANDS;
  74. }
  75. }