Modifier and Type | Method and Description |
---|---|
NPC |
createNPC(org.bukkit.entity.EntityType type,
String name)
Creates an despawned
NPC . |
NPC |
createNPC(org.bukkit.entity.EntityType type,
UUID uuid,
int id,
String name)
Creates an
NPC with the given id. |
void |
deregister(NPC npc)
Deregisters the
NPC and removes all data about it from the data store. |
void |
deregisterAll()
Deregisters all
NPC s from this registry. |
void |
despawnNPCs(DespawnReason reason)
Despawn all NPCs within the registry.
|
NPC |
getById(int id)
Gets the
NPC with the given ID if it exists. |
NPC |
getByUniqueId(UUID uuid)
Gets the
NPC with the given unique ID if it exists. |
NPC |
getByUniqueIdGlobal(UUID uuid)
Gets the
NPC with the given unique ID if it exists, otherwise null. |
String |
getName()
Gets the name of the registry.
|
NPC |
getNPC(org.bukkit.entity.Entity entity)
Tries to convert the given
Entity to a spawned NPC . |
boolean |
isNPC(org.bukkit.entity.Entity entity)
Checks whether the given
Entity is convertable to an NPC . |
void |
saveToStore()
Saves the NPCs to the internal
NPCDataStore |
Iterable<NPC> |
sorted()
Returns a sorted view of this registry, sorted by NPC id.
|
forEach, iterator, spliterator
NPC createNPC(org.bukkit.entity.EntityType type, String name)
NPC
.type
- EntityType
to assign to the NPCname
- Name to give the NPCNPC createNPC(org.bukkit.entity.EntityType type, UUID uuid, int id, String name)
NPC
with the given id. WARNING: may overwrite any existing NPC in the registry with the same
ID.type
- The EntityType
of the NPC.id
- The NPC IDname
- The NPC namevoid deregister(NPC npc)
NPC
and removes all data about it from the data store.npc
- The NPC to deregistervoid deregisterAll()
NPC
s from this registry. deregister(NPC)
void despawnNPCs(DespawnReason reason)
reload
- The reason to despawnNPC getById(int id)
NPC
with the given ID if it exists.id
- ID of the NPCNPC getByUniqueId(UUID uuid)
NPC
with the given unique ID if it exists.uuid
- UUID of the NPCNPC getByUniqueIdGlobal(UUID uuid)
NPC
with the given unique ID if it exists, otherwise null.uuid
- ID of the NPCString getName()
NPC getNPC(org.bukkit.entity.Entity entity)
Entity
to a spawned NPC
.entity
- Entity to get the NPC fromboolean isNPC(org.bukkit.entity.Entity entity)
Entity
is convertable to an NPC
.entity
- Entity to checkvoid saveToStore()
NPCDataStore
Copyright © 2021. All rights reserved.