Fix display name

This commit is contained in:
Mike Primm 2020-05-16 20:34:30 -05:00
parent 04aafb54da
commit 86619a1d0d

View File

@ -162,7 +162,6 @@ public class DynmapPlugin
private long perTickLimit = (50000000); // 50 ms private long perTickLimit = (50000000); // 50 ms
private boolean isMCPC = false; private boolean isMCPC = false;
private boolean useSaveFolder = true; private boolean useSaveFolder = true;
private Field displayName = null; // MCPC+ display name
private static final int SIGNPOST_ID = 63; private static final int SIGNPOST_ID = 63;
private static final int WALLSIGN_ID = 68; private static final int WALLSIGN_ID = 68;
@ -436,13 +435,6 @@ public class DynmapPlugin
{ {
plugin = this; plugin = this;
this.server = srv; this.server = srv;
displayName = null;
try {
displayName = EntityPlayerMP.class.getField("displayName");
} catch (SecurityException e) {
} catch (NoSuchFieldException e) {
}
} }
public boolean isOp(String player) { public boolean isOp(String player) {
@ -1137,8 +1129,10 @@ public class DynmapPlugin
@Override @Override
public String getName() public String getName()
{ {
if(player != null) if(player != null) {
return player.getEntity().getName().getString(); String n = player.getEntity().getName().getString();;
return n;
}
else else
return "[Server]"; return "[Server]";
} }
@ -1146,14 +1140,8 @@ public class DynmapPlugin
public String getDisplayName() public String getDisplayName()
{ {
if(player != null) { if(player != null) {
if (displayName != null) { String n = player.getDisplayName().getString();
try { return n;
return (String) displayName.get(player);
} catch (IllegalArgumentException e) {
} catch (IllegalAccessException e) {
}
}
return player.getDisplayName().getUnformattedComponentText();
} }
else else
return "[Server]"; return "[Server]";