mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-12-25 10:38:19 +01:00
Only set the hook if it's different
This commit is contained in:
parent
70cb9c5275
commit
637d6cda18
@ -37,6 +37,7 @@ import com.comphenix.protocol.error.DetailedErrorReporter;
|
|||||||
import com.comphenix.protocol.error.ErrorReporter;
|
import com.comphenix.protocol.error.ErrorReporter;
|
||||||
import com.comphenix.protocol.injector.DelayedSingleTask;
|
import com.comphenix.protocol.injector.DelayedSingleTask;
|
||||||
import com.comphenix.protocol.injector.PacketFilterManager;
|
import com.comphenix.protocol.injector.PacketFilterManager;
|
||||||
|
import com.comphenix.protocol.injector.PacketFilterManager.PlayerInjectHooks;
|
||||||
import com.comphenix.protocol.metrics.Statistics;
|
import com.comphenix.protocol.metrics.Statistics;
|
||||||
import com.comphenix.protocol.metrics.Updater;
|
import com.comphenix.protocol.metrics.Updater;
|
||||||
import com.comphenix.protocol.reflect.compiler.BackgroundCompiler;
|
import com.comphenix.protocol.reflect.compiler.BackgroundCompiler;
|
||||||
@ -138,7 +139,13 @@ public class ProtocolLibrary extends JavaPlugin {
|
|||||||
|
|
||||||
// Update injection hook
|
// Update injection hook
|
||||||
try {
|
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) {
|
} catch (IllegalArgumentException e) {
|
||||||
detailedReporter.reportWarning(config, "Cannot parse injection method. Using default.", e);
|
detailedReporter.reportWarning(config, "Cannot parse injection method. Using default.", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user