Package net.citizensnpcs.api
Class CitizensAPI
java.lang.Object
net.citizensnpcs.api.CitizensAPI
Contains methods used in order to utilize the Citizens API.
-
Method Summary
Modifier and TypeMethodDescriptionstatic NPCRegistry
Creates a new anonymousNPCRegistry
with its own set ofNPC
s.static NPCRegistry
Creates a newNPCRegistry
with its own set ofNPC
s that does not save to disk.static NPCRegistry
createNamedNPCRegistry
(String name, NPCDataStore store) Creates a newNPCRegistry
with its own set ofNPC
s.static CommandManager
static File
static NPCSelector
static LocationLookup
static NPCRegistry
getNamedNPCRegistry
(String name) Retrieves theNPCRegistry
previously created viacreateNamedNPCRegistry(String, NPCDataStore)
with the given name, or null if not found.static NMSHelper
static Iterable
<NPCRegistry> static NPCRegistry
Gets the current implementation's defaultNPCRegistry
.static Plugin
static TemplateRegistry
static NPCRegistry
Gets the current implementation's default temporaryNPCRegistry
.static TraitFactory
Gets the current implementation'sTraitFactory
.static boolean
static void
registerEvents
(Listener listener) A helper method for registering events using the current implementation'sPlugin
.static void
removeNamedNPCRegistry
(String name) Removes any previously createdNPCRegistry
stored under the given name.static void
setImplementation
(CitizensPlugin implementation) Sets the current Citizens implementation.static void
shutdown()
Shuts down any resources currently being held.static void
talk
(SpeechContext context)
-
Method Details
-
createAnonymousNPCRegistry
Creates a new anonymousNPCRegistry
with its own set ofNPC
s. This is not stored by the Citizens plugin.- Parameters:
store
- TheNPCDataStore
to use with the registry- Returns:
- A new anonymous NPCRegistry that is not accessible via
getNamedNPCRegistry(String)
- Since:
- 2.0.8
-
createInMemoryNPCRegistry
Creates a newNPCRegistry
with its own set ofNPC
s that does not save to disk. -
createNamedNPCRegistry
Creates a newNPCRegistry
with its own set ofNPC
s. This is stored in memory with the Citizens plugin, and can be accessed viagetNamedNPCRegistry(String)
.- Parameters:
name
- The plugin namestore
- TheNPCDataStore
to use with the registry- Returns:
- A new NPCRegistry, that can also be retrieved via
getNamedNPCRegistry(String)
- Since:
- 2.0.8
-
getCommandManager
-
getDataFolder
- Returns:
- The data folder of the current implementation
-
getDefaultNPCSelector
- Returns:
- The default NPC selector
-
getLocationLookup
-
getNamedNPCRegistry
Retrieves theNPCRegistry
previously created viacreateNamedNPCRegistry(String, NPCDataStore)
with the given name, or null if not found.- Parameters:
name
- The registry name- Returns:
- A NPCRegistry previously created via
createNamedNPCRegistry(String, NPCDataStore)
, or null if not found - Since:
- 2.0.8
-
getNMSHelper
-
getNPCRegistries
-
getNPCRegistry
Gets the current implementation's defaultNPCRegistry
.- Returns:
- The NPC registry
-
getPlugin
- Returns:
- The current
Plugin
providing an implementation
-
getTemplateRegistry
-
getTemporaryNPCRegistry
Gets the current implementation's default temporaryNPCRegistry
.- Returns:
- The temporary NPC registry
-
getTraitFactory
Gets the current implementation'sTraitFactory
.- Returns:
- Citizens trait factory
- See Also:
-
hasImplementation
public static boolean hasImplementation()- Returns:
- Whether a Citizens implementation is currently present
-
registerEvents
A helper method for registering events using the current implementation'sPlugin
.- Parameters:
listener
- The listener to register events for- See Also:
-
removeNamedNPCRegistry
Removes any previously createdNPCRegistry
stored under the given name.- Parameters:
name
- The name previously given tocreateNamedNPCRegistry(String, NPCDataStore)
- Since:
- 2.0.8
-
setImplementation
Sets the current Citizens implementation.- Parameters:
implementation
- The new implementation
-
shutdown
public static void shutdown()Shuts down any resources currently being held. -
talk
-