Skip to content

Commit

Permalink
Subtle behaviour change to make players remove themselves from tablis…
Browse files Browse the repository at this point in the history
…t on death
  • Loading branch information
fullwall committed Nov 12, 2022
1 parent 102630a commit c02391c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Expand Up @@ -5,7 +5,6 @@
import org.bukkit.entity.Player;

import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.npc.skin.SkinnableEntity;
import net.citizensnpcs.util.NMS;

public abstract class AbstractEntityController implements EntityController {
Expand All @@ -31,8 +30,6 @@ public void remove() {
return;
if (bukkitEntity instanceof Player) {
NMS.removeFromWorld(bukkitEntity);
SkinnableEntity npc = bukkitEntity instanceof SkinnableEntity ? (SkinnableEntity) bukkitEntity : null;
npc.getSkinTracker().onRemoveNPC();
NMS.remove(bukkitEntity);
setEntity(null);
} else {
Expand Down
5 changes: 5 additions & 0 deletions main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java
Expand Up @@ -102,6 +102,11 @@ public boolean despawn(DespawnReason reason) {
trait.onDespawn();
}
Messaging.debug("Despawned", this, "DespawnReason." + reason);

if (getEntity() instanceof SkinnableEntity) {
((SkinnableEntity) getEntity()).getSkinTracker().onRemoveNPC();
}

if (reason == DespawnReason.DEATH) {
entityController.setEntity(null);
} else {
Expand Down
2 changes: 1 addition & 1 deletion main/src/main/resources/messages_en.properties
Expand Up @@ -299,7 +299,7 @@ citizens.commands.trait.removed=Removed {0} successfully.
citizens.commands.traitc.missing=Trait not found.
citizens.commands.traitc.not-configurable=That trait is not configurable.
citizens.commands.traitc.not-on-npc=The NPC doesn''t have that trait.
citizens.commands.unknown-command=Unknown command. Did you mean:
citizens.commands.unknown-command=Unknown command.
citizens.commands.waypoints.add.waypoint-added=Added waypoint at [[{0}]] (index [[{1}]]).
citizens.commands.waypoints.disableteleporting.disabled=[[{0}]] will no longer teleport when stuck pathfinding.
citizens.commands.waypoints.disableteleporting.enabled=[[{0}]] will now teleport when stuck pathfinding.
Expand Down

0 comments on commit c02391c

Please sign in to comment.