Skip to content

Commit

Permalink
Java is weird and maven is weird and minecraft is weird
Browse files Browse the repository at this point in the history
everything is weird
  • Loading branch information
mcmonkey4eva committed May 24, 2016
1 parent 0e6ab8a commit bb615ac
Showing 1 changed file with 6 additions and 21 deletions.
Expand Up @@ -33,8 +33,7 @@ public class PlayerProfileEditor {
private static final Map<UUID, GameProfile> fakeProfiles = new HashMap<UUID, GameProfile>();
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<String, Field> fields = PacketHelper.registerFields(PacketPlayOutPlayerInfo.class);
Expand All @@ -43,38 +42,24 @@ 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);
profileIdField = GameProfile.class.getDeclaredField("id");
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);
}
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());
}
Expand All @@ -85,13 +70,13 @@ public static void updatePlayerProfiles(PacketPlayOutPlayerInfo packet) {
if (action != EnumPlayerInfoAction.ADD_PLAYER) {
return;
}
/*List<PacketPlayOutPlayerInfo.PlayerInfoData> dataList = (List<PacketPlayOutPlayerInfo.PlayerInfoData>) 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);
Expand Down

0 comments on commit bb615ac

Please sign in to comment.