Fix Boolean parsing issue

This commit is contained in:
fullwall 2020-07-10 12:28:39 +08:00
parent 652a68a79d
commit 429264dbf0
2 changed files with 8 additions and 4 deletions

View File

@ -268,8 +268,10 @@ public class CitizensNPC extends AbstractNPC {
NMS.setHeadYaw(getEntity(), at.getYaw());
NMS.setBodyYaw(getEntity(), at.getYaw());
String nameplateVisible = data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, !requiresNameHologram())
.toString();
String nameplateVisible = data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString();
if (requiresNameHologram()) {
nameplateVisible = "false";
}
getEntity().setCustomNameVisible(Boolean.parseBoolean(nameplateVisible));
// Set the spawned state

View File

@ -77,7 +77,8 @@ public class HologramTrait extends Trait {
private void load() {
currentLoc = npc.getStoredLocation();
int i = 0;
if (npc.requiresNameHologram() && npc.data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true)) {
if (npc.requiresNameHologram()
&& Boolean.parseBoolean(npc.data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString())) {
nameNPC = createHologram(npc.getFullName(), 0);
}
for (String line : lines) {
@ -114,7 +115,8 @@ public class HologramTrait extends Trait {
return;
}
if (npc.requiresNameHologram()) {
boolean visible = npc.data().get(NPC.NAMEPLATE_VISIBLE_METADATA, true);
boolean visible = Boolean
.parseBoolean(npc.data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString());
if (nameNPC != null && !visible) {
nameNPC.destroy();
nameNPC = null;