Add onRemove for cleanup code

This commit is contained in:
fullwall 2022-11-23 19:13:17 +08:00
parent 5408e7059c
commit b28d689cbd
3 changed files with 15 additions and 0 deletions

View File

@ -96,6 +96,11 @@ public class ScoreboardTrait extends Trait {
}
}
@Override
public void onRemove() {
onDespawn();
}
@Override
public void onSpawn() {
changed = true;

View File

@ -35,6 +35,11 @@ public class SitTrait extends Trait {
}
}
@Override
public void onRemove() {
onDespawn();
}
@Override
public void run() {
if (!npc.isSpawned() || !isSitting()) {

View File

@ -105,6 +105,11 @@ public class BossBarTrait extends Trait {
}
}
@Override
public void onRemove() {
onDespawn();
}
@Override
public void run() {
if (!npc.isSpawned())