CannotMoveAnymoreInVehicle.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.clientpackets;
  16. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  17. import net.sf.l2j.gameserver.serverpackets.StopMoveInVehicle;
  18. import net.sf.l2j.util.Point3D;
  19. /**
  20. * @author Maktakien
  21. *
  22. */
  23. public final class CannotMoveAnymoreInVehicle extends L2GameClientPacket
  24. {
  25. private int _x;
  26. private int _y;
  27. private int _z;
  28. private int _heading;
  29. private int _boatId;
  30. @Override
  31. protected void readImpl()
  32. {
  33. _boatId = readD();
  34. _x = readD();
  35. _y = readD();
  36. _z = readD();
  37. _heading = readD();
  38. }
  39. @Override
  40. protected void runImpl()
  41. {
  42. L2PcInstance player = getClient().getActiveChar();
  43. if (player == null)
  44. {
  45. return;
  46. }
  47. if(player.isInBoat())
  48. {
  49. if(player.getBoat().getObjectId() == _boatId)
  50. {
  51. player.setInBoatPosition(new Point3D(_x,_y,_z));
  52. player.getPosition().setHeading(_heading);
  53. StopMoveInVehicle msg = new StopMoveInVehicle(player,_boatId);
  54. player.broadcastPacket(msg);
  55. }
  56. }
  57. }
  58. @Override
  59. public String getType()
  60. {
  61. return "[C] 5D CannotMoveAnymoreInVehicle";
  62. }
  63. }