Package net.risingworld.api.events.world
Class ExplosionEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.world.ExplosionEvent
- All Implemented Interfaces:
Cancellable
Called when an explosion is triggered (e.g caused by tnt).
Example: Prevent explosion from causing any damage (but it's still visible) Example: Suppress explosion, so it neither causes damage nor is visible at all
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionshort
Sets the amount of damage this explosion deals for npcs (e.g animals).short
Gets the amount of damage this explosion deals for players.Gets the global world position of the explosion.Gets the related item which caused this explosion (e.g tnt).Gets the player who is responsible for this explosion.short
Sets the amount of damage this explosion deals for world structures (i.e buildings), objects and vegetations.boolean
Determines if the event is cancelled.boolean
Gets whether or not other explosives will be triggered by this explosion.void
setCancelled
(boolean cancel) Cancels this event.void
setNpcDamage
(short damage) Sets the amount of damage this explosion deals for npcs (e.g animals).void
setPlayerDamage
(short damage) Sets the amount of damage this explosion deals for players.void
setPosition
(float x, float y, float z) Changes the global world position of the explosion.void
setPosition
(Vector3f position) Changes the global world position of the explosion.void
setTriggerExplosives
(boolean set) Sets whether or not this explosion should trigger other explosives.void
setWorldDamage
(short damage) Sets the amount of damage this explosion deals for world structures (i.e buildings), objects and vegetations.
-
Method Details
-
getPosition
Gets the global world position of the explosion.- Returns:
- the global position, as a Vector3f
-
setPosition
Changes the global world position of the explosion.- Parameters:
position
- the new position.
-
setPosition
public void setPosition(float x, float y, float z) Changes the global world position of the explosion.- Parameters:
x
- the new x position.y
- the new y position.z
- the new z position.
-
getRelatedItem
Gets the related item which caused this explosion (e.g tnt). If this explosion wasn't caused by an item, this function returns null.- Returns:
- the item which caused this explosion, or null if there is no related item.
-
setPlayerDamage
public void setPlayerDamage(short damage) Sets the amount of damage this explosion deals for players. Set to 0 to prevent this explosion from harming players.- Parameters:
damage
- the amount of damage (players).
-
getPlayerDamage
public short getPlayerDamage()Gets the amount of damage this explosion deals for players.- Returns:
- the amount of damage (players).
-
setNpcDamage
public void setNpcDamage(short damage) Sets the amount of damage this explosion deals for npcs (e.g animals). Set to 0 to prevent this explosion from harming npcs.- Parameters:
damage
- the amount of damage (npcs).
-
getNpcDamage
public short getNpcDamage()Sets the amount of damage this explosion deals for npcs (e.g animals).- Returns:
- the amount of damage (npcs).
-
setWorldDamage
public void setWorldDamage(short damage) Sets the amount of damage this explosion deals for world structures (i.e buildings), objects and vegetations. Set to 0 to prevent this explosion from causing any damage to the world.- Parameters:
damage
- the amount of damage (world).
-
getWorldDamage
public short getWorldDamage()Sets the amount of damage this explosion deals for world structures (i.e buildings), objects and vegetations.- Returns:
- the amount of damage (world).
-
setTriggerExplosives
public void setTriggerExplosives(boolean set) Sets whether or not this explosion should trigger other explosives.- Parameters:
set
- true to trigger other explosives which are in proximity, false to prevent this behaviour.
-
isTriggerExplosivesEnabled
public boolean isTriggerExplosivesEnabled()Gets whether or not other explosives will be triggered by this explosion.- Returns:
- true if other explosives in proximity get triggered by this explosion, false if not.
-
getRelatedPlayer
Gets the player who is responsible for this explosion. Returns null if this explosion is not caused by a player.- Returns:
- the player who triggered this explosion, or null if this explosion wasn't caused by a player.
-
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
-