From 637d6cda18e9828c2555951547ffc0ac14aa4d31 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sun, 13 Jan 2013 14:58:07 +0100 Subject: [PATCH] Only set the hook if it's different --- .../java/com/comphenix/protocol/ProtocolLibrary.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java index ec800646..2f5e0322 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/ProtocolLibrary.java @@ -37,6 +37,7 @@ import com.comphenix.protocol.error.DetailedErrorReporter; import com.comphenix.protocol.error.ErrorReporter; import com.comphenix.protocol.injector.DelayedSingleTask; import com.comphenix.protocol.injector.PacketFilterManager; +import com.comphenix.protocol.injector.PacketFilterManager.PlayerInjectHooks; import com.comphenix.protocol.metrics.Statistics; import com.comphenix.protocol.metrics.Updater; import com.comphenix.protocol.reflect.compiler.BackgroundCompiler; @@ -138,7 +139,13 @@ public class ProtocolLibrary extends JavaPlugin { // Update injection hook try { - protocolManager.setPlayerHook(config.getInjectionMethod()); + PlayerInjectHooks hook = config.getInjectionMethod(); + + // Only update the hook if it's different + if (protocolManager.getPlayerHook().equals(hook)) { + protocolManager.setPlayerHook(hook); + logger.info("Changing player hook to " + hook); + } } catch (IllegalArgumentException e) { detailedReporter.reportWarning(config, "Cannot parse injection method. Using default.", e); }