2
0

AdminRide.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. "admin_ride_wyvern",
  25. "admin_ride_strider",
  26. "admin_unride_wyvern",
  27. "admin_unride_strider",
  28. "admin_unride",
  29. "admin_ride_wolf",
  30. "admin_unride_wolf",
  31. };
  32. private int _petRideId;
  33. public boolean useAdminCommand(String command, L2PcInstance activeChar) {
  34. if(command.startsWith("admin_ride"))
  35. {
  36. if(activeChar.isMounted() || activeChar.getPet() != null)
  37. {
  38. activeChar.sendMessage("You already have a pet.");
  39. return false;
  40. }
  41. if (command.startsWith("admin_ride_wyvern")) {
  42. _petRideId = 12621;
  43. }
  44. else if (command.startsWith("admin_ride_strider")) {
  45. _petRideId = 12526;
  46. }
  47. else if (command.startsWith("admin_ride_wolf")) {
  48. _petRideId = 16030;
  49. }
  50. else
  51. {
  52. activeChar.sendMessage("Command '"+command+"' not recognized");
  53. return false;
  54. }
  55. activeChar.mount(_petRideId, 0);
  56. return false;
  57. }
  58. else if(command.startsWith("admin_unride"))
  59. {
  60. activeChar.dismount();
  61. }
  62. return true;
  63. }
  64. public String[] getAdminCommandList() {
  65. return ADMIN_COMMANDS;
  66. }
  67. }