From 288950edd472308df21435d199314feafe45fcae Mon Sep 17 00:00:00 2001 From: asofold Date: Wed, 16 Jul 2014 13:28:26 +0200 Subject: [PATCH] Use predefined packet types, add comments. --- .../nocheatplus/net/protocollib/MoveFrequency.java | 11 +---------- .../net/protocollib/ProtocolLibComponent.java | 1 + .../nocheatplus/net/protocollib/WeatherDistance.java | 4 ++++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/MoveFrequency.java b/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/MoveFrequency.java index 6642b9e0..27f747da 100644 --- a/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/MoveFrequency.java +++ b/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/MoveFrequency.java @@ -30,20 +30,11 @@ public class MoveFrequency extends PacketAdapter implements Listener, JoinLeaveL // TODO: Optimized options (receive only, other?). // TODO: Async version ? -// private static Collection getPacketTypes() { -// final Collection packetTypes = PacketType.fromName("C03PacketPlayer"); -// if (packetTypes.isEmpty()) { -// throw new RuntimeException("Packet types not available."); -// } -// return packetTypes; -// } - private Map freqMap = new LinkedHashMap(); public MoveFrequency(Plugin plugin) { // PacketPlayInFlying[3, legacy: 10] - super(plugin, PacketType.findCurrent(Protocol.PLAY, Sender.CLIENT, 3)); //getPacketTypes()); - // TODO: Try to get packet by name first + legacy first. + super(plugin, PacketType.Play.Client.FLYING); // TODO: How does POS and POS_LOOK relate/translate? } private ActionFrequency addName(String name) { diff --git a/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/ProtocolLibComponent.java b/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/ProtocolLibComponent.java index f61f32b7..88bad03c 100644 --- a/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/ProtocolLibComponent.java +++ b/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/ProtocolLibComponent.java @@ -31,6 +31,7 @@ public class ProtocolLibComponent implements DisableListener{ MoveFrequency.class, WeatherDistance.class ); + // TODO: Configurability. for (Class clazz : adapterClasses) { try { // Construct a new instance using reflection. diff --git a/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/WeatherDistance.java b/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/WeatherDistance.java index 347ea872..ac314200 100644 --- a/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/WeatherDistance.java +++ b/NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/net/protocollib/WeatherDistance.java @@ -14,6 +14,9 @@ import fr.neatmonster.nocheatplus.utilities.TrigUtil; public class WeatherDistance extends PacketAdapter { + // TODO: Will not be effective with 512 radius, if they add the patch by @Amranth. + // TODO: For lower distances more packets might need to be intercepted. + /** Maximum distance for thunder effects (squared). */ private static final double distSq = 512.0 * 512.0; // TODO: Maybe configurable. @@ -27,6 +30,7 @@ public class WeatherDistance extends PacketAdapter { final Player player = event.getPlayer(); // Compare sound effect name. + // TODO: wither-spawn-sound-radius, dragon-death-sound-radius, other ? if (!packetContainer.getStrings().read(0).equals("ambient.weather.thunder")) { return; }