From 321ecdb3c2be324fe4bef7acddb0bd0ced3c5ce3 Mon Sep 17 00:00:00 2001 From: NavidK0 Date: Thu, 18 Feb 2016 17:45:11 -0500 Subject: [PATCH] Cleaned up code --- .../disguise/disguisetypes/PlayerDisguise.java | 8 +++----- .../disguise/utilities/DisguiseUtilities.java | 13 +++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 06e42779..a85df6ec 100644 --- a/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/main/java/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -1,16 +1,14 @@ package me.libraryaddict.disguise.disguisetypes; -import org.apache.commons.lang.Validate; -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; import me.libraryaddict.disguise.utilities.LibsProfileLookup; import me.libraryaddict.disguise.utilities.ReflectionManager; +import org.apache.commons.lang.Validate; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; public class PlayerDisguise extends TargetedDisguise { diff --git a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java index b1096fd1..bbc8c19c 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/DisguiseUtilities.java @@ -90,8 +90,7 @@ public class DisguiseUtilities { block = ReflectionManager.getNmsClass("Block").getMethod("getById", int.class) .invoke(null, Material.BED_BLOCK.getId()); } catch (Exception ex) { - block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"), "byId").get(null))[Material.BED_BLOCK - .getId()]; + block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"), "byId").get(null))[Material.BED_BLOCK.getId()]; } Method fromLegacyData = block.getClass().getMethod("fromLegacyData", int.class); Method setType = chunkSection.getClass().getMethod("setType", int.class, int.class, int.class, @@ -251,9 +250,7 @@ public class DisguiseUtilities { try { Object entityTrackerEntry = ReflectionManager.getEntityTrackerEntry(disguise.getEntity()); if (entityTrackerEntry != null) { - Set trackedPlayers = (Set) ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers").get( - entityTrackerEntry); - Object trackedPlayersObj = ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers").get(entityTrackerEntry); + Set trackedPlayers = (Set) ReflectionManager.getNmsField("EntityTrackerEntry", "trackedPlayers").get(entityTrackerEntry); // If the tracker exists. Remove himself from his tracker trackedPlayers = new HashSet(trackedPlayers); //Copy before iterating to prevent ConcurrentModificationException PacketContainer destroyPacket = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY); @@ -481,6 +478,7 @@ public class DisguiseUtilities { * Pass in a set, check if it's a hashset. * If it's not, return false. * If you pass in something else, you failed. + * * @param obj * @return */ @@ -794,11 +792,6 @@ public class DisguiseUtilities { return false; } - @Deprecated - public static void removeGameprofile(String string) { - removeGameProfile(string); - } - public static void removeGameProfile(String string) { gameProfiles.remove(string.toLowerCase()); }