mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 03:05:28 +01:00
Fix display name
This commit is contained in:
parent
04aafb54da
commit
86619a1d0d
@ -162,7 +162,6 @@ public class DynmapPlugin
|
||||
private long perTickLimit = (50000000); // 50 ms
|
||||
private boolean isMCPC = false;
|
||||
private boolean useSaveFolder = true;
|
||||
private Field displayName = null; // MCPC+ display name
|
||||
|
||||
private static final int SIGNPOST_ID = 63;
|
||||
private static final int WALLSIGN_ID = 68;
|
||||
@ -436,13 +435,6 @@ public class DynmapPlugin
|
||||
{
|
||||
plugin = this;
|
||||
this.server = srv;
|
||||
|
||||
displayName = null;
|
||||
try {
|
||||
displayName = EntityPlayerMP.class.getField("displayName");
|
||||
} catch (SecurityException e) {
|
||||
} catch (NoSuchFieldException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOp(String player) {
|
||||
@ -1137,8 +1129,10 @@ public class DynmapPlugin
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
if(player != null)
|
||||
return player.getEntity().getName().getString();
|
||||
if(player != null) {
|
||||
String n = player.getEntity().getName().getString();;
|
||||
return n;
|
||||
}
|
||||
else
|
||||
return "[Server]";
|
||||
}
|
||||
@ -1146,14 +1140,8 @@ public class DynmapPlugin
|
||||
public String getDisplayName()
|
||||
{
|
||||
if(player != null) {
|
||||
if (displayName != null) {
|
||||
try {
|
||||
return (String) displayName.get(player);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalAccessException e) {
|
||||
}
|
||||
}
|
||||
return player.getDisplayName().getUnformattedComponentText();
|
||||
String n = player.getDisplayName().getString();
|
||||
return n;
|
||||
}
|
||||
else
|
||||
return "[Server]";
|
||||
|
Loading…
Reference in New Issue
Block a user