From 3f60b5ee272f9f4dcbb4c654010eeb32d60ec4e6 Mon Sep 17 00:00:00 2001 From: Shevchik Date: Wed, 11 Dec 2013 15:35:02 +0400 Subject: [PATCH] Rewrite packet listener --- src/com/cnaude/chairs/PacketListener.java | 31 ++--------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/com/cnaude/chairs/PacketListener.java b/src/com/cnaude/chairs/PacketListener.java index df22854..bf13579 100644 --- a/src/com/cnaude/chairs/PacketListener.java +++ b/src/com/cnaude/chairs/PacketListener.java @@ -2,7 +2,7 @@ package com.cnaude.chairs; import org.bukkit.entity.Player; -import com.comphenix.protocol.Packets; +import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.events.ListenerPriority; import com.comphenix.protocol.events.PacketAdapter; @@ -17,14 +17,13 @@ public class PacketListener { this.pm = pm; this.pluginInstance = plugin; playerDismountListener(); - falledPlayerDismountListener(); } private void playerDismountListener() { pm.getAsynchronousManager().registerAsyncHandler( new PacketAdapter(PacketAdapter - .params(pluginInstance, Packets.Client.PLAYER_INPUT) + .params(pluginInstance, PacketType.Play.Client.STEER_VEHICLE) .clientSide() .listenerPriority(ListenerPriority.HIGHEST) .optionIntercept() @@ -49,30 +48,4 @@ public class PacketListener { }).syncStart(); } - private void falledPlayerDismountListener() - { - pm.getAsynchronousManager().registerAsyncHandler( - new PacketAdapter(PacketAdapter - .params(pluginInstance, Packets.Client.ENTITY_ACTION) - .clientSide() - .listenerPriority(ListenerPriority.HIGHEST) - .optionIntercept() - ) - { - @Override - public void onPacketReceiving(final PacketEvent e) - { - if (!e.isCancelled()) - { - //eject player if he is in chair and tryes to sneak (it is impossible unless arrow will disappear in client due to server lags) - Player player = e.getPlayer(); - if (pluginInstance.sit.containsKey(player.getName())) - { - pluginInstance.unSitPlayer(player,false); - } - } - } - }).syncStart(); - } - }