diff --git a/src/main/java/net/aufdemrand/denizen/utilities/PlayerProfileEditor.java b/src/main/java/net/aufdemrand/denizen/utilities/PlayerProfileEditor.java index e9a7d64792..8970200ef6 100644 --- a/src/main/java/net/aufdemrand/denizen/utilities/PlayerProfileEditor.java +++ b/src/main/java/net/aufdemrand/denizen/utilities/PlayerProfileEditor.java @@ -33,8 +33,7 @@ public class PlayerProfileEditor { private static final Map fakeProfiles = new HashMap(); private static final Field playerGameProfile, gameProfileId, gameProfileName; private static final Field playerInfo_action, playerInfo_data; - /*private static final Field playerInfoData_latency, playerInfoData_gameMode, - playerInfoData_gameProfile, playerInfoData_displayName;*/ + private static final Field playerInfoData_gameProfile; static { Map fields = PacketHelper.registerFields(PacketPlayOutPlayerInfo.class); @@ -43,10 +42,7 @@ public class PlayerProfileEditor { Field profileField = null; Field profileIdField = null; Field profileNameField = null; - Field pidLatency = null; - Field pidGameMode = null; Field pidGameProfile = null; - Field pidDisplayName = null; try { profileField = EntityHuman.class.getDeclaredField("bS"); profileField.setAccessible(true); @@ -54,16 +50,8 @@ public class PlayerProfileEditor { profileIdField.setAccessible(true); profileNameField = GameProfile.class.getDeclaredField("name"); profileNameField.setAccessible(true); - // TODO: FIX THIS STUFF? IDK WHAT'S WRONG WITH IT - /*pidLatency = PacketPlayOutPlayerInfo.PlayerInfoData.class.getDeclaredField("b"); - pidLatency.setAccessible(true); - pidGameMode = PacketPlayOutPlayerInfo.PlayerInfoData.class.getDeclaredField("c"); - pidGameMode.setAccessible(true); - pidGameProfile = PacketPlayOutPlayerInfo.PlayerInfoData.class.getDeclaredField("d"); + pidGameProfile = PacketPlayOutPlayerInfo.class.getDeclaredClasses()[0].getDeclaredField("d"); // PlayerInfoData. pidGameProfile.setAccessible(true); - pidDisplayName = PacketPlayOutPlayerInfo.PlayerInfoData.class.getDeclaredField("e"); - pidDisplayName.setAccessible(true); - */ } catch (Exception e) { dB.echoError(e); @@ -71,10 +59,7 @@ public class PlayerProfileEditor { playerGameProfile = profileField; gameProfileId = profileIdField; gameProfileName = profileNameField; - /*playerInfoData_latency = pidLatency; - playerInfoData_gameMode = pidGameMode; playerInfoData_gameProfile = pidGameProfile; - playerInfoData_displayName = pidDisplayName;*/ DenizenAPI.getCurrentInstance().getServer().getPluginManager() .registerEvents(new PlayerProfileEditorListener(), DenizenAPI.getCurrentInstance()); } @@ -85,13 +70,13 @@ public static void updatePlayerProfiles(PacketPlayOutPlayerInfo packet) { if (action != EnumPlayerInfoAction.ADD_PLAYER) { return; } - /*List dataList = (List) playerInfo_data.get(packet); - for (PacketPlayOutPlayerInfo.PlayerInfoData data : dataList) { - GameProfile gameProfile = data.a(); + List dataList = (List) playerInfo_data.get(packet); + for (Object data : dataList) { + GameProfile gameProfile = (GameProfile) playerInfoData_gameProfile.get(data); if (fakeProfiles.containsKey(gameProfile.getId())) { playerInfoData_gameProfile.set(data, fakeProfiles.get(gameProfile.getId())); } - }*/ + } } catch (Exception e) { dB.echoError(e);