diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java index aab68333..cc847467 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java @@ -5,7 +5,6 @@ import com.github.retrooper.packetevents.event.PacketListenerAbstract; import com.github.retrooper.packetevents.event.PacketListenerPriority; import com.github.retrooper.packetevents.event.PacketReceiveEvent; -import com.github.retrooper.packetevents.protocol.PacketSide; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; import me.xginko.aef.modules.AEFModule; @@ -81,17 +80,16 @@ public void run() { @Override public void onPacketReceive(PacketReceiveEvent event) { - if (event.getPacketType().getSide() != PacketSide.CLIENT) return; - if (event.getUser() == null) return; - UUID player = event.getUser().getUUID(); - if (player == null || !playerDataMap.containsKey(event.getUser().getUUID())) return; + if (event.isCancelled() || event.getUser() == null) return; + if (event.getUser().getUUID() == null || !playerDataMap.containsKey(event.getUser().getUUID())) return; if ( event.getPacketType() == PacketType.Play.Client.PLAYER_FLYING || event.getPacketType() == PacketType.Play.Client.PLAYER_POSITION || event.getPacketType() == PacketType.Play.Client.PLAYER_POSITION_AND_ROTATION ) { - playerDataMap.get(player).updateLatestPosition(new WrapperPlayClientPlayerFlying(event).getLocation()); + playerDataMap.get(event.getUser().getUUID()) + .updateLatestPosition(new WrapperPlayClientPlayerFlying(event).getLocation()); } } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java index 98e6a463..18364d30 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/modules/elytra/ElytraHelper.java @@ -5,7 +5,6 @@ import com.github.retrooper.packetevents.event.PacketListenerAbstract; import com.github.retrooper.packetevents.event.PacketListenerPriority; import com.github.retrooper.packetevents.event.PacketReceiveEvent; -import com.github.retrooper.packetevents.protocol.PacketSide; import com.github.retrooper.packetevents.protocol.packettype.PacketType; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying; import me.xginko.aef.modules.AEFModule; @@ -89,17 +88,16 @@ public void run() { @Override public void onPacketReceive(PacketReceiveEvent event) { - if (event.getPacketType().getSide() != PacketSide.CLIENT) return; - if (event.getUser() == null) return; - UUID player = event.getUser().getUUID(); - if (player == null || !playerDataMap.containsKey(event.getUser().getUUID())) return; + if (event.isCancelled() || event.getUser() == null) return; + if (event.getUser().getUUID() == null || !playerDataMap.containsKey(event.getUser().getUUID())) return; if ( event.getPacketType() == PacketType.Play.Client.PLAYER_FLYING || event.getPacketType() == PacketType.Play.Client.PLAYER_POSITION || event.getPacketType() == PacketType.Play.Client.PLAYER_POSITION_AND_ROTATION ) { - playerDataMap.get(player).updateLatestPosition(new WrapperPlayClientPlayerFlying(event).getLocation()); + playerDataMap.get(event.getUser().getUUID()) + .updateLatestPosition(new WrapperPlayClientPlayerFlying(event).getLocation()); } }