Guest User

Untitled

a guest
Jan 4th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. package be.slypi.quidditch.listeners;
  2.  
  3. import org.bukkit.entity.Player;
  4. import org.bukkit.event.Listener;
  5. import org.bukkit.util.Vector;
  6.  
  7. import com.comphenix.protocol.PacketType;
  8. import com.comphenix.protocol.events.PacketAdapter;
  9. import com.comphenix.protocol.events.PacketEvent;
  10.  
  11. import be.slypi.quidditch.QMain;
  12.  
  13. public class PacketListener implements Listener {
  14.  
  15. private static QMain main;
  16. private static boolean on;
  17.  
  18. public PacketListener(QMain main) {
  19. PacketListener.main = main;
  20. }
  21.  
  22. public static void listenChatPackets() {
  23. if(on) return;
  24. on = true;
  25.  
  26. QMain.getProtocolManager().addPacketListener(new PacketAdapter(main, PacketType.Play.Client.ENTITY_ACTION) {
  27.  
  28. @Override
  29. public void onPacketReceiving(PacketEvent e) {
  30. if(e.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) {
  31. Player p = e.getPlayer();
  32. if(e.getPacketType().getCurrentId() == 5) {
  33. ????????????
  34. if(p.isInsideVehicle()) {
  35. p.getVehicle().setVelocity(new Vector(0.0f, 0.8f, 0.0f));
  36. }
  37. }
  38. }
  39. }
  40.  
  41.  
  42. });
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment