Class PlayerRespawnEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.player.PlayerEvent
net.risingworld.api.events.player.PlayerRespawnEvent
- All Implemented Interfaces:
Cancellable
Called when a player respawns after death.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the spawn position.Gets the spawn rotation.Gets the type of the spawn point where the player wants to respawn.boolean
Determines if the event is cancelled.boolean
Gets whether or not the player will keep his inventory upon respawn.void
setCancelled
(boolean cancel) Cancels this event.void
setKeepInventory
(boolean set) Setting this to true causes the player to keep his current inventory.void
setSpawnPosition
(float x, float y, float z) Sets the spawn position of the player.void
setSpawnPosition
(Vector3f position) Sets the spawn position of the player.void
setSpawnRotation
(Quaternion rotation) Sets the spawn rotation of the player.Methods inherited from class net.risingworld.api.events.player.PlayerEvent
getPlayer
-
Method Details
-
getSpawnType
Gets the type of the spawn point where the player wants to respawn.- Returns:
- the respawn point type.
-
getSpawnPosition
Gets the spawn position.- Returns:
- the global spawn position as a Vector3f.
-
setSpawnPosition
Sets the spawn position of the player.- Parameters:
position
- a Vector3f containing the global spawn coordinates.
-
setSpawnPosition
public void setSpawnPosition(float x, float y, float z) Sets the spawn position of the player.- Parameters:
x
- global X spawn coordinate.y
- global Y spawn coordinate.z
- global Z spawn coordinate.
-
getSpawnRotation
Gets the spawn rotation.- Returns:
- the spawn rotation as a Quaternion.
-
setSpawnRotation
Sets the spawn rotation of the player.- Parameters:
rotation
- a Quaternion which describes the spawn rotation.
-
setKeepInventory
public void setKeepInventory(boolean set) Setting this to true causes the player to keep his current inventory. This also enables you to change the inventory within this event, e.g if you want a certain player to respawn only with a sword (without having to change the global default spawn inventory), you can clear his inventory, then insert a sword and call this method (set it to true).- Parameters:
set
- true to let the player keep his inventory, or false if you want him to respawn with the default spawn inventory.- Example: Clear player inventory when he respawns
-
isKeepingInventory
public boolean isKeepingInventory()Gets whether or not the player will keep his inventory upon respawn. This either happens if it was set to true previously (setKeepInventory(boolean)
), or if the particular player permission (general_keepinventory
) is set to true.- Returns:
- true if the player will keep his inventory upon respawn, false if he will be equipped with the default spawn inventory instead.
-
isCancelled
public boolean isCancelled()Description copied from interface: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.- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- true if the event is cancelled, or false if not.
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:Cancellable
Cancels this event. This means it will no longer be executed, but other plugins will still receive the event.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- set to true if you want to cancel this event.- Example: Cancel "PlayerEnterAreaEvent", i.e prevent player from entering an area
-