AdminRide.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  17. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  18. /**
  19. * @author
  20. */
  21. public class AdminRide implements IAdminCommandHandler
  22. {
  23. private static final String[] ADMIN_COMMANDS =
  24. {
  25. "admin_ride_wyvern",
  26. "admin_ride_strider",
  27. "admin_unride_wyvern",
  28. "admin_unride_strider",
  29. "admin_unride",
  30. "admin_ride_wolf",
  31. "admin_unride_wolf",
  32. };
  33. private int _petRideId;
  34. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  35. {
  36. if (command.startsWith("admin_ride"))
  37. {
  38. if (activeChar.isMounted() || activeChar.getPet() != null)
  39. {
  40. activeChar.sendMessage("You already have a pet.");
  41. return false;
  42. }
  43. if (command.startsWith("admin_ride_wyvern"))
  44. {
  45. _petRideId = 12621;
  46. }
  47. else if (command.startsWith("admin_ride_strider"))
  48. {
  49. _petRideId = 12526;
  50. }
  51. else if (command.startsWith("admin_ride_wolf"))
  52. {
  53. _petRideId = 16030;
  54. }
  55. else
  56. {
  57. activeChar.sendMessage("Command '" + command + "' not recognized");
  58. return false;
  59. }
  60. activeChar.mount(_petRideId, 0);
  61. return false;
  62. }
  63. else if (command.startsWith("admin_unride"))
  64. {
  65. activeChar.dismount();
  66. }
  67. return true;
  68. }
  69. public String[] getAdminCommandList()
  70. {
  71. return ADMIN_COMMANDS;
  72. }
  73. }