From 477464851ef50da05d784f16a98ef97d4a60f72c Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Tue, 21 Mar 2017 19:34:12 +1300 Subject: [PATCH] Fix a little typo for disguise cloning --- .../disguisetypes/PlayerDisguise.java | 25 ++++++++----------- .../disguise/utilities/ReflectionManager.java | 3 ++- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index d8a3db4b..8f2c19dd 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -99,12 +99,11 @@ public class PlayerDisguise extends TargetedDisguise { disguise.playerName = getName(); - if (disguise.currentLookup == null && disguise.gameProfile != null) { + if (currentLookup == null && gameProfile != null) { disguise.skinToUse = getSkin(); - disguise.gameProfile = ReflectionManager.getGameProfileWithThisSkin(disguise.uuid, getGameProfile().getName(), - getGameProfile()); - } - else { + disguise.gameProfile = ReflectionManager.getGameProfileWithThisSkin(disguise.uuid, + getGameProfile().getName(), getGameProfile()); + } else { disguise.setSkin(getSkin()); } @@ -129,8 +128,7 @@ public class PlayerDisguise extends TargetedDisguise { if (gameProfile == null) { if (getSkin() != null) { gameProfile = ReflectionManager.getGameProfile(uuid, getName()); - } - else { + } else { gameProfile = ReflectionManager.getGameProfileWithThisSkin(uuid, getName(), DisguiseUtilities.getProfileFromMojang(this)); } @@ -280,8 +278,7 @@ public class PlayerDisguise extends TargetedDisguise { if (newSkin == null) { currentLookup = null; gameProfile = null; - } - else { + } else { if (newSkin.length() > 16) { skinToUse = newSkin.substring(0, 16); } @@ -293,8 +290,7 @@ public class PlayerDisguise extends TargetedDisguise { /** * Set the GameProfile, without tampering. * - * @param gameProfile - * GameProfile + * @param gameProfile GameProfile * @return */ public PlayerDisguise setSkin(WrappedGameProfile gameProfile) { @@ -315,15 +311,16 @@ public class PlayerDisguise extends TargetedDisguise { if (isDisplayedInTab()) { PacketContainer addTab = new PacketContainer(PacketType.Play.Server.PLAYER_INFO); addTab.getPlayerInfoAction().write(0, PlayerInfoAction.ADD_PLAYER); - addTab.getPlayerInfoDataLists().write(0, Arrays.asList(new PlayerInfoData(getGameProfile(), 0, - NativeGameMode.SURVIVAL, WrappedChatComponent.fromText(getName())))); + addTab.getPlayerInfoDataLists().write(0, Arrays.asList( + new PlayerInfoData(getGameProfile(), 0, NativeGameMode.SURVIVAL, + WrappedChatComponent.fromText(getName())))); PacketContainer deleteTab = addTab.shallowClone(); deleteTab.getPlayerInfoAction().write(0, PlayerInfoAction.REMOVE_PLAYER); try { for (Player player : Bukkit.getOnlinePlayers()) { - if (!((TargetedDisguise) this).canSee(player)) + if (!canSee(player)) continue; ProtocolLibrary.getProtocolManager().sendServerPacket(player, deleteTab); diff --git a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java index f1ae24b8..cb1bc0b6 100644 --- a/src/me/libraryaddict/disguise/utilities/ReflectionManager.java +++ b/src/me/libraryaddict/disguise/utilities/ReflectionManager.java @@ -430,8 +430,9 @@ public class ReflectionManager { WrappedGameProfile gameProfile = new WrappedGameProfile(uuid != null ? uuid : UUID.randomUUID(), playerName); - if (profileWithSkin != null) + if (profileWithSkin != null) { gameProfile.getProperties().putAll(profileWithSkin.getProperties()); + } return gameProfile; }