mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-06-26 14:35:03 +02:00
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);
|
Messaging.sendErrorTr(sender, Messages.NPC_NAME_TOO_LONG);
|
||||||
newName = newName.substring(0, nameLength);
|
newName = newName.substring(0, nameLength);
|
||||||
}
|
}
|
||||||
Location prev = npc.isSpawned() ? npc.getEntity().getLocation() : null;
|
|
||||||
npc.despawn(DespawnReason.PENDING_RESPAWN);
|
|
||||||
npc.setName(newName);
|
npc.setName(newName);
|
||||||
if (prev != null) {
|
|
||||||
npc.spawn(prev, SpawnReason.RESPAWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
Messaging.sendTr(sender, Messages.NPC_RENAMED, oldName, newName);
|
Messaging.sendTr(sender, Messages.NPC_RENAMED, oldName, newName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,7 +402,8 @@ public class CitizensNPC extends AbstractNPC {
|
||||||
EntityType type = isSpawned() ? getEntity().getType() : getTrait(MobType.class).getType();
|
EntityType type = isSpawned() ? getEntity().getType() : getTrait(MobType.class).getType();
|
||||||
if (type == null)
|
if (type == null)
|
||||||
return;
|
return;
|
||||||
if (Util.isAlwaysFlyable(type)) {
|
if (!Util.isAlwaysFlyable(type))
|
||||||
|
return;
|
||||||
if (!data().has(NPC.FLYABLE_METADATA)) {
|
if (!data().has(NPC.FLYABLE_METADATA)) {
|
||||||
data().setPersistent(NPC.FLYABLE_METADATA, true);
|
data().setPersistent(NPC.FLYABLE_METADATA, true);
|
||||||
}
|
}
|
||||||
|
@ -410,7 +411,6 @@ public class CitizensNPC extends AbstractNPC {
|
||||||
getTrait(Gravity.class).setEnabled(true);
|
getTrait(Gravity.class).setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static final SetMultimap<ChunkCoord, NPC> CHUNK_LOADERS = HashMultimap.create();
|
private static final SetMultimap<ChunkCoord, NPC> CHUNK_LOADERS = HashMultimap.create();
|
||||||
private static final String NPC_METADATA_MARKER = "NPC";
|
private static final String NPC_METADATA_MARKER = "NPC";
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.citizensnpcs.api.persistence.Persist;
|
||||||
import net.citizensnpcs.api.trait.Trait;
|
import net.citizensnpcs.api.trait.Trait;
|
||||||
import net.citizensnpcs.api.trait.TraitName;
|
import net.citizensnpcs.api.trait.TraitName;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
|
import net.citizensnpcs.util.Util;
|
||||||
|
|
||||||
@TraitName("scoreboardtrait")
|
@TraitName("scoreboardtrait")
|
||||||
public class ScoreboardTrait extends Trait {
|
public class ScoreboardTrait extends Trait {
|
||||||
|
@ -67,6 +68,9 @@ public class ScoreboardTrait extends Trait {
|
||||||
npc.data().remove(NPC.GLOWING_COLOR_METADATA);
|
npc.data().remove(NPC.GLOWING_COLOR_METADATA);
|
||||||
}
|
}
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
|
if (SUPPORT_GLOWING_COLOR && Util.getMinecraftRevision().contains("1_12_R1")) {
|
||||||
|
SUPPORT_GLOWING_COLOR = false;
|
||||||
|
}
|
||||||
if (SUPPORT_GLOWING_COLOR) {
|
if (SUPPORT_GLOWING_COLOR) {
|
||||||
try {
|
try {
|
||||||
if (team.getColor() == null || previousGlowingColor == null
|
if (team.getColor() == null || previousGlowingColor == null
|
||||||
|
|
Loading…
Reference in New Issue
Block a user