Package net.risingworld.api.events.npc
Klasse NpcSpawnEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.npc.NpcSpawnEvent
- Alle implementierten Schnittstellen:
Cancellable
Called when an npc is about to spawn. Cancelling this event prevents the
npc from spawning.
-
Verschachtelte Klassen - Übersicht
-
Feldübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibunglong
Gets the global ID that will be assigned to the npc once it spawns.getNpc()
Gets the npc that is about to spawn.Gets the origin of this npc spawn, i.e the reason why this npc spawns (e.g natural spawn, or spawned via command etc).Returns the related player.short
Gets the type ID of the npc.int
boolean
Determines if the event is cancelled.void
setCancelled
(boolean cancel) Cancels this event.void
setPosition
(float x, float y, float z) void
setPosition
(Vector3f position) void
setRotation
(float x, float y, float z, float w) void
setRotation
(Quaternion rotation) void
setTypeID
(short newTypeID) void
setVariation
(int newVariation)
-
Methodendetails
-
getNpc
Gets the npc that is about to spawn.- Gibt zurück:
- the npc that is about to spawn (unless the event is cancelled).
-
getGlobalID
public long getGlobalID()Gets the global ID that will be assigned to the npc once it spawns.- Gibt zurück:
- the unique global ID of the npc.
-
getTypeID
public short getTypeID()Gets the type ID of the npc.- Gibt zurück:
- the type ID of the npc (i.e the internal ID of the npc in the definitions table. For example, pigs have ID 1, cows have ID 2 etc).
-
setTypeID
public void setTypeID(short newTypeID) -
getVariation
public int getVariation() -
setVariation
public void setVariation(int newVariation) -
getPosition
-
setPosition
-
setPosition
public void setPosition(float x, float y, float z) -
getRotation
-
setRotation
-
setRotation
public void setRotation(float x, float y, float z, float w) -
getOrigin
Gets the origin of this npc spawn, i.e the reason why this npc spawns (e.g natural spawn, or spawned via command etc).- Gibt zurück:
- the npc spawn origin.
-
getRelatedPlayer
Returns the related player. This only works if the npc was spawned via command (then the player who executed the command will be returned), otherwise null will be returned.- Gibt zurück:
- the player who spawned this npc, or null if this npc spawned naturally.
-
isCancelled
public boolean isCancelled()Beschreibung aus Schnittstelle kopiert:Cancellable
Determines if the event is cancelled. If an event is cancelled, it will no longer be executed, but other plugins will still receive the event.
Please note: If the event is threaded, cancellation has no effect, i.e the event will still be executed.- Angegeben von:
isCancelled
in SchnittstelleCancellable
- Gibt zurück:
- true if the event is cancelled, or false if not.
-
setCancelled
public void setCancelled(boolean cancel) Beschreibung aus Schnittstelle kopiert:Cancellable
Cancels this event. This means it will no longer be executed, but other plugins will still receive the event.- Angegeben von:
setCancelled
in SchnittstelleCancellable
- Parameter:
cancel
- set to true if you want to cancel this event.- Example: Cancel "PlayerEnterAreaEvent", i.e prevent player from entering an area
-