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 NPCRegistryCreates a new anonymousNPCRegistrywith its own set ofNPCs.static NPCRegistryCreates a newNPCRegistrywith its own set ofNPCs that does not save to disk.static NPCRegistrycreateNamedNPCRegistry(String name, NPCDataStore store) Creates a newNPCRegistrywith its own set ofNPCs.static CommandManagerstatic Filestatic NPCSelectorstatic LocationLookupstatic NPCRegistrygetNamedNPCRegistry(String name) Retrieves theNPCRegistrypreviously created viacreateNamedNPCRegistry(String, NPCDataStore)with the given name, or null if not found.static NMSHelperstatic Iterable<NPCRegistry> static NPCRegistryGets the current implementation's defaultNPCRegistry.static Pluginstatic TemplateRegistrystatic NPCRegistryGets the current implementation's default temporaryNPCRegistry.static TraitFactoryGets the current implementation'sTraitFactory.static booleanstatic voidregisterEvents(Listener listener) A helper method for registering events using the current implementation'sPlugin.static voidremoveNamedNPCRegistry(String name) Removes any previously createdNPCRegistrystored under the given name.static voidsetImplementation(CitizensPlugin implementation) Sets the current Citizens implementation.static voidshutdown()Shuts down any resources currently being held.static voidtalk(SpeechContext context)
-
Method Details
-
createAnonymousNPCRegistry
Creates a new anonymousNPCRegistrywith its own set ofNPCs. This is not stored by the Citizens plugin.- Parameters:
store- TheNPCDataStoreto use with the registry- Returns:
- A new anonymous NPCRegistry that is not accessible via
getNamedNPCRegistry(String) - Since:
- 2.0.8
-
createInMemoryNPCRegistry
Creates a newNPCRegistrywith its own set ofNPCs that does not save to disk. -
createNamedNPCRegistry
Creates a newNPCRegistrywith its own set ofNPCs. This is stored in memory with the Citizens plugin, and can be accessed viagetNamedNPCRegistry(String).- Parameters:
name- The plugin namestore- TheNPCDataStoreto 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 theNPCRegistrypreviously 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
Pluginproviding 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 createdNPCRegistrystored 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
-