Package noppes.npcs.api.handler
Interface ICloneHandler
-
public interface ICloneHandlerHandles storing and spawning cloned entities. Clones are organized by numbered tabs (0-based) or named folders.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IEntityget(int tab, String name, IWorld world)Returns a specific clone from a tab by name.IEntityget(String folderName, String name, IWorld world)Returns a specific clone from a custom folder by name.IEntity[]getFolder(String folderName, IWorld world)Returns all clones stored in the specified custom folder.String[]getFolders()Returns all custom folder names.IEntity[]getTab(int tab, IWorld world)Returns all clones stored in the specified tab.booleanhas(int tab, String name)Checks whether a clone with the given name exists in the tab.booleanhas(String folderName, String name)Checks whether a clone exists in a custom folder.booleanhasFolder(String folderName)Checks whether a custom folder exists.voidremove(int tab, String name)Removes a clone from the given tab.voidremove(String folderName, String name)Removes a clone from a custom folder.voidset(int tab, String name, IEntity entity)Stores an entity as a clone in the given tab with the specified name.voidset(String folderName, String name, IEntity entity)Stores an entity as a clone in a custom folder.IEntityspawn(double x, double y, double z, int tab, String name, IWorld world)Spawns a clone at the given coordinates with default protection rules.IEntityspawn(double x, double y, double z, int tab, String name, IWorld world, boolean ignoreProtection)Spawns a clone at the given coordinates.IEntityspawn(double x, double y, double z, String folderName, String name, IWorld world)Spawns a clone from a custom folder with default protection rules.IEntityspawn(double x, double y, double z, String folderName, String name, IWorld world, boolean ignoreProtection)Spawns a clone from a custom folder at the given coordinates.IEntityspawn(IPos pos, int tab, String name, IWorld world)Spawns a clone at the given position with default protection rules.IEntityspawn(IPos pos, int tab, String name, IWorld world, boolean ignoreProtection)Spawns a clone at the given position.IEntityspawn(IPos pos, String folderName, String name, IWorld world)Spawns a clone from a custom folder at the given position with default protection rules.IEntityspawn(IPos pos, String folderName, String name, IWorld world, boolean ignoreProtection)Spawns a clone from a custom folder at the given position.
-
-
-
Method Detail
-
spawn
IEntity spawn(double x, double y, double z, int tab, String name, IWorld world, boolean ignoreProtection)
Spawns a clone at the given coordinates.- Parameters:
x- the x coordinate.y- the y coordinate.z- the z coordinate.tab- the tab index.name- the clone name.world- the world to spawn in.ignoreProtection- whether to bypass spawn protection.- Returns:
- the spawned entity, or null on failure.
-
spawn
IEntity spawn(IPos pos, int tab, String name, IWorld world, boolean ignoreProtection)
Spawns a clone at the given position.- Parameters:
pos- the position.tab- the tab index.name- the clone name.world- the world to spawn in.ignoreProtection- whether to bypass spawn protection.- Returns:
- the spawned entity, or null on failure.
-
spawn
IEntity spawn(double x, double y, double z, int tab, String name, IWorld world)
Spawns a clone at the given coordinates with default protection rules.- Parameters:
x- the x coordinate.y- the y coordinate.z- the z coordinate.tab- the tab index.name- the clone name.world- the world to spawn in.- Returns:
- the spawned entity, or null on failure.
-
spawn
IEntity spawn(IPos pos, int tab, String name, IWorld world)
Spawns a clone at the given position with default protection rules.- Parameters:
pos- the position.tab- the tab index.name- the clone name.world- the world to spawn in.- Returns:
- the spawned entity, or null on failure.
-
getTab
IEntity[] getTab(int tab, IWorld world)
Returns all clones stored in the specified tab.- Parameters:
tab- the tab index.world- the world context for entity creation.- Returns:
- an array of entities in the tab.
-
get
IEntity get(int tab, String name, IWorld world)
Returns a specific clone from a tab by name.- Parameters:
tab- the tab index.name- the clone name.world- the world context for entity creation.- Returns:
- the entity, or null if not found.
-
has
boolean has(int tab, String name)Checks whether a clone with the given name exists in the tab.- Parameters:
tab- the tab index.name- the clone name.- Returns:
- true if the clone exists; false otherwise.
-
set
void set(int tab, String name, IEntity entity)Stores an entity as a clone in the given tab with the specified name.- Parameters:
tab- the tab index.name- the clone name.entity- the entity to store.
-
remove
void remove(int tab, String name)Removes a clone from the given tab.- Parameters:
tab- the tab index.name- the clone name.
-
getFolders
String[] getFolders()
Returns all custom folder names.- Returns:
- an array of folder names.
-
hasFolder
boolean hasFolder(String folderName)
Checks whether a custom folder exists.- Parameters:
folderName- the folder name.- Returns:
- true if the folder exists; false otherwise.
-
spawn
IEntity spawn(double x, double y, double z, String folderName, String name, IWorld world, boolean ignoreProtection)
Spawns a clone from a custom folder at the given coordinates.- Parameters:
x- the x coordinate.y- the y coordinate.z- the z coordinate.folderName- the folder name.name- the clone name.world- the world to spawn in.ignoreProtection- whether to bypass spawn protection.- Returns:
- the spawned entity, or null on failure.
-
spawn
IEntity spawn(IPos pos, String folderName, String name, IWorld world, boolean ignoreProtection)
Spawns a clone from a custom folder at the given position.- Parameters:
pos- the position.folderName- the folder name.name- the clone name.world- the world to spawn in.ignoreProtection- whether to bypass spawn protection.- Returns:
- the spawned entity, or null on failure.
-
spawn
IEntity spawn(double x, double y, double z, String folderName, String name, IWorld world)
Spawns a clone from a custom folder with default protection rules.- Parameters:
x- the x coordinate.y- the y coordinate.z- the z coordinate.folderName- the folder name.name- the clone name.world- the world to spawn in.- Returns:
- the spawned entity, or null on failure.
-
spawn
IEntity spawn(IPos pos, String folderName, String name, IWorld world)
Spawns a clone from a custom folder at the given position with default protection rules.- Parameters:
pos- the position.folderName- the folder name.name- the clone name.world- the world to spawn in.- Returns:
- the spawned entity, or null on failure.
-
getFolder
IEntity[] getFolder(String folderName, IWorld world)
Returns all clones stored in the specified custom folder.- Parameters:
folderName- the folder name.world- the world context for entity creation.- Returns:
- an array of entities in the folder.
-
get
IEntity get(String folderName, String name, IWorld world)
Returns a specific clone from a custom folder by name.- Parameters:
folderName- the folder name.name- the clone name.world- the world context for entity creation.- Returns:
- the entity, or null if not found.
-
has
boolean has(String folderName, String name)
Checks whether a clone exists in a custom folder.- Parameters:
folderName- the folder name.name- the clone name.- Returns:
- true if the clone exists; false otherwise.
-
set
void set(String folderName, String name, IEntity entity)
Stores an entity as a clone in a custom folder.- Parameters:
folderName- the folder name.name- the clone name.entity- the entity to store.
-
-