Package noppes.npcs.api.handler
Interface ITelegraphHandler
-
public interface ITelegraphHandlerHandler for creating and managing telegraphs. Access via API.getTelegraphs()Example usage:
// Create a telegraph var telegraph = API.getTelegraphs().createCircle(5.0); telegraph.setDuration(60); // 3 seconds telegraph.setColor(0x80FF0000); // Semi-transparent red // Spawn it var instance = telegraph.spawn(world, x, y, z); // Or save as a preset for reuse API.getTelegraphs().save("myCircle", telegraph); // Load preset later var loaded = API.getTelegraphs().get("myCircle"); loaded.spawn(world, x, y, z);
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ITelegraphcreate(String type)Create a telegraph by type name.ITelegraphcreateCircle(float radius)Create a circle telegraph.ITelegraphcreateCone(float length, float angle)Create a cone telegraph.ITelegraphcreateLine(float length, float width)Create a line telegraph.ITelegraphcreatePoint()Create a point telegraph.ITelegraphcreateRing(float outerRadius, float innerRadius)Create a ring telegraph.ITelegraphcreateSquare(float radius)Create a square telegraph.voiddelete(String name)Delete a saved preset.ITelegraphget(String name)Get a saved telegraph preset by name.String[]getSavedNames()Get all saved preset names.booleanhas(String name)Check if a preset exists.voidremove(String instanceId)Remove an active telegraph by instance ID.voidremove(ITelegraphInstance instance)Remove an active telegraph instance.voidsave(String name, ITelegraph telegraph)Save a telegraph as a preset.ITelegraphInstancespawn(ITelegraph telegraph, IEntity entity)Spawn a telegraph following an entity.ITelegraphInstancespawn(ITelegraph telegraph, IEntity entity, float yaw)Spawn a telegraph following an entity with rotation.ITelegraphInstancespawn(ITelegraph telegraph, IWorld world, double x, double y, double z)Spawn a telegraph at a position.ITelegraphInstancespawn(ITelegraph telegraph, IWorld world, double x, double y, double z, float yaw)Spawn a telegraph at a position with rotation.
-
-
-
Method Detail
-
createCircle
ITelegraph createCircle(float radius)
Create a circle telegraph.- Parameters:
radius- The radius of the circle- Returns:
- A new telegraph configuration
-
createRing
ITelegraph createRing(float outerRadius, float innerRadius)
Create a ring telegraph.- Parameters:
outerRadius- The outer radiusinnerRadius- The inner radius- Returns:
- A new telegraph configuration
-
createLine
ITelegraph createLine(float length, float width)
Create a line telegraph.- Parameters:
length- The length of the linewidth- The width of the line- Returns:
- A new telegraph configuration
-
createCone
ITelegraph createCone(float length, float angle)
Create a cone telegraph.- Parameters:
length- The length of the coneangle- The angle of the cone in degrees- Returns:
- A new telegraph configuration
-
createSquare
ITelegraph createSquare(float radius)
Create a square telegraph. The square is axis-aligned by default and can be rotated with yaw when spawned.- Parameters:
radius- The half-size of the square (distance from center to edge)- Returns:
- A new telegraph configuration
-
createPoint
ITelegraph createPoint()
Create a point telegraph.- Returns:
- A new telegraph configuration
-
create
ITelegraph create(String type)
Create a telegraph by type name.- Parameters:
type- Type name: "circle", "ring", "line", "cone", "square", "point" (case insensitive)- Returns:
- A new telegraph configuration, or null if type is invalid
-
spawn
ITelegraphInstance spawn(ITelegraph telegraph, IWorld world, double x, double y, double z)
Spawn a telegraph at a position.- Parameters:
telegraph- The telegraph configurationworld- The worldx- X positiony- Y positionz- Z position- Returns:
- The spawned instance
-
spawn
ITelegraphInstance spawn(ITelegraph telegraph, IWorld world, double x, double y, double z, float yaw)
Spawn a telegraph at a position with rotation.- Parameters:
telegraph- The telegraph configurationworld- The worldx- X positiony- Y positionz- Z positionyaw- Rotation yaw- Returns:
- The spawned instance
-
spawn
ITelegraphInstance spawn(ITelegraph telegraph, IEntity entity)
Spawn a telegraph following an entity.- Parameters:
telegraph- The telegraph configurationentity- The entity to follow- Returns:
- The spawned instance
-
spawn
ITelegraphInstance spawn(ITelegraph telegraph, IEntity entity, float yaw)
Spawn a telegraph following an entity with rotation.- Parameters:
telegraph- The telegraph configurationentity- The entity to followyaw- Rotation yaw- Returns:
- The spawned instance
-
get
ITelegraph get(String name)
Get a saved telegraph preset by name.- Parameters:
name- The preset name- Returns:
- The telegraph configuration, or null if not found
-
save
void save(String name, ITelegraph telegraph)
Save a telegraph as a preset.- Parameters:
name- The name for the presettelegraph- The telegraph configuration to save
-
delete
void delete(String name)
Delete a saved preset.- Parameters:
name- The preset name
-
has
boolean has(String name)
Check if a preset exists.- Parameters:
name- The preset name- Returns:
- True if the preset exists
-
getSavedNames
String[] getSavedNames()
Get all saved preset names.- Returns:
- Array of preset names
-
remove
void remove(String instanceId)
Remove an active telegraph by instance ID.- Parameters:
instanceId- The instance ID to remove
-
remove
void remove(ITelegraphInstance instance)
Remove an active telegraph instance.- Parameters:
instance- The instance to remove
-
-