-
-
Notifications
You must be signed in to change notification settings - Fork 0
API Persistence & Loading
Eisi05 edited this page Jan 21, 2026
·
1 revision
NPCs can be saved to disk:
npc.save();This writes to:
<plugin data folder>/NPC/<uuid>.npc
You can check:
boolean saved = npc.isSaved();NpcApi.createInstance(...) calls NpcManager.loadNPCs().
Loading behavior:
- NPCs are read from the
NPC/folder. - If the NPC’s world isn’t loaded yet, it is queued and spawned when the world loads.
import de.eisi05.npc.api.manager.NpcManager;
List<NPC> npcs = NpcManager.getList();
NpcManager.fromUUID(uuid).ifPresent(npc -> {
// do something
});Call NpcApi.disable() in your plugin shutdown to:
- hide NPCs
- uninject packet readers
- stop tasks
- clear static state