Hide all npcs on plugin disable
This commit is contained in:
parent
28300cded5
commit
08d69f6848
2 changed files with 5 additions and 0 deletions
|
@ -143,6 +143,7 @@ public class ZNpcsPlus extends JavaPlugin {
|
||||||
log(ChatColor.WHITE + " * Loading data...");
|
log(ChatColor.WHITE + " * Loading data...");
|
||||||
npcRegistry.reload();
|
npcRegistry.reload();
|
||||||
|
|
||||||
|
shutdownTasks.add(npcRegistry::unload);
|
||||||
shutdownTasks.add(scheduler::cancelAll);
|
shutdownTasks.add(scheduler::cancelAll);
|
||||||
shutdownTasks.add(userManager::shutdown);
|
shutdownTasks.add(userManager::shutdown);
|
||||||
shutdownTasks.add(adventure::close);
|
shutdownTasks.add(adventure::close);
|
||||||
|
|
|
@ -146,4 +146,8 @@ public class NpcRegistryImpl implements NpcRegistry {
|
||||||
if (!npcIdLookupMap.containsKey(id)) return;
|
if (!npcIdLookupMap.containsKey(id)) return;
|
||||||
npcIdLookupMap.remove(id).getNpc().delete();
|
npcIdLookupMap.remove(id).getNpc().delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void unload() {
|
||||||
|
npcList.forEach(npcEntry -> npcEntry.getNpc().getViewers().forEach(npcEntry.getNpc()::UNSAFE_hide));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue