From a33bb0b13968b30bbe5853f256f47a77158387e3 Mon Sep 17 00:00:00 2001 From: NavidK0 Date: Sat, 28 Mar 2015 19:59:42 -0400 Subject: [PATCH] Added config option ContactMojangServers which disables player skins, but stops the plugin from pinging Mojang servers. --- src/main/java/me/libraryaddict/disguise/LibsDisguises.java | 3 +++ .../libraryaddict/disguise/disguisetypes/PlayerDisguise.java | 5 ++++- src/main/resources/config.yml | 3 +++ src/main/resources/plugin.yml | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java index bdc4ff9f..9a18a838 100644 --- a/src/main/java/me/libraryaddict/disguise/LibsDisguises.java +++ b/src/main/java/me/libraryaddict/disguise/LibsDisguises.java @@ -43,6 +43,8 @@ import com.comphenix.protocol.wrappers.WrappedWatchableObject; import me.libraryaddict.disguise.utilities.Metrics; public class LibsDisguises extends JavaPlugin { + + public static LibsDisguises instance; //I'm sorry Sun MicroSystems and all mighty Java God @Override public void onEnable() { @@ -103,6 +105,7 @@ public class LibsDisguises extends JavaPlugin { getCommand("disguiseclone").setExecutor(new DisguiseCloneCommand(listener)); getCommand("libsdisguises").setExecutor(new LibsDisguisesCommand()); registerValues(); + instance = this; try { Metrics metrics = new Metrics(this); metrics.start(); diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index e04b2403..20453cba 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -5,6 +5,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import com.comphenix.protocol.wrappers.WrappedGameProfile; +import me.libraryaddict.disguise.LibsDisguises; import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher; import me.libraryaddict.disguise.utilities.DisguiseUtilities; @@ -153,6 +154,9 @@ public class PlayerDisguise extends TargetedDisguise { public PlayerDisguise setSkin(String skinToUse) { this.skinToUse = skinToUse; + if (!LibsDisguises.instance.getConfig().getBoolean("ContactMojangServers")) { + return this; + } if (skinToUse == null) { this.currentLookup = null; this.gameProfile = null; @@ -161,7 +165,6 @@ public class PlayerDisguise extends TargetedDisguise { this.skinToUse = skinToUse.substring(0, 16); } currentLookup = new LibsProfileLookup() { - @Override public void onLookup(WrappedGameProfile gameProfile) { if (currentLookup == this && gameProfile != null) { diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index ea08db4e..11586dc6 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -91,6 +91,9 @@ MiscDisguisesForLiving: true # Turn this to true to have players undisguised when switching worlds UndisguiseOnWorldChange: false +# Contact Mojang's servers? Disabling this option will disable player skin disguises! +ContactMojangServers: true + # This will help performance, especially with CPU # Due to safety reasons, self disguises can never have their packets disabled. PacketsEnabled: diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 26eaf8e6..88733fa5 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: LibsDisguises main: me.libraryaddict.disguise.LibsDisguises -version: 8.4 +version: 8.3.1 author: libraryaddict authors: [Byteflux, Navid K.] depend: [ProtocolLib]