Use old logic for glowing colour in 1.12, remove unnecessary respawn in /npc rename for non-Player NPCs
This commit is contained in:
parent
5f6026f50b
commit
1e507a1d57
|
@ -1472,12 +1472,7 @@ public class NPCCommands {
|
|||
Messaging.sendErrorTr(sender, Messages.NPC_NAME_TOO_LONG);
|
||||
newName = newName.substring(0, nameLength);
|
||||
}
|
||||
Location prev = npc.isSpawned() ? npc.getEntity().getLocation() : null;
|
||||
npc.despawn(DespawnReason.PENDING_RESPAWN);
|
||||
npc.setName(newName);
|
||||
if (prev != null) {
|
||||
npc.spawn(prev, SpawnReason.RESPAWN);
|
||||
}
|
||||
|
||||
Messaging.sendTr(sender, Messages.NPC_RENAMED, oldName, newName);
|
||||
}
|
||||
|
|
|
@ -402,13 +402,13 @@ public class CitizensNPC extends AbstractNPC {
|
|||
EntityType type = isSpawned() ? getEntity().getType() : getTrait(MobType.class).getType();
|
||||
if (type == null)
|
||||
return;
|
||||
if (Util.isAlwaysFlyable(type)) {
|
||||
if (!data().has(NPC.FLYABLE_METADATA)) {
|
||||
data().setPersistent(NPC.FLYABLE_METADATA, true);
|
||||
}
|
||||
if (!hasTrait(Gravity.class)) {
|
||||
getTrait(Gravity.class).setEnabled(true);
|
||||
}
|
||||
if (!Util.isAlwaysFlyable(type))
|
||||
return;
|
||||
if (!data().has(NPC.FLYABLE_METADATA)) {
|
||||
data().setPersistent(NPC.FLYABLE_METADATA, true);
|
||||
}
|
||||
if (!hasTrait(Gravity.class)) {
|
||||
getTrait(Gravity.class).setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.citizensnpcs.api.persistence.Persist;
|
|||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.citizensnpcs.util.Util;
|
||||
|
||||
@TraitName("scoreboardtrait")
|
||||
public class ScoreboardTrait extends Trait {
|
||||
|
@ -67,6 +68,9 @@ public class ScoreboardTrait extends Trait {
|
|||
npc.data().remove(NPC.GLOWING_COLOR_METADATA);
|
||||
}
|
||||
if (color != null) {
|
||||
if (SUPPORT_GLOWING_COLOR && Util.getMinecraftRevision().contains("1_12_R1")) {
|
||||
SUPPORT_GLOWING_COLOR = false;
|
||||
}
|
||||
if (SUPPORT_GLOWING_COLOR) {
|
||||
try {
|
||||
if (team.getColor() == null || previousGlowingColor == null
|
||||
|
|
Loading…
Reference in New Issue