Class FireworkEvent

java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.world.FireworkEvent
All Implemented Interfaces:
Cancellable

public final class FireworkEvent extends Event implements Cancellable
Called when a firework is triggered (e.g caused by a firework rocket).
  • Method Details

    • getPosition

      public Vector3f getPosition()
      Gets the global world position of the firework.
      Returns:
      the global position, as a Vector3f.
    • setPosition

      public void setPosition(Vector3f position)
      Changes the global world position of the firework.
      Parameters:
      position - the new position.
    • setPosition

      public void setPosition(float x, float y, float z)
      Changes the global world position of the firework.
      Parameters:
      x - the new x position.
      y - the new y position.
      z - the new z position.
    • getSize

      public Vector3f getSize()
      Gets the size of the firework.
      Returns:
      the size, as a Vector3f.
    • setSize

      public void setSize(Vector3f size)
      Sets the size of the firework.
      Parameters:
      size - the new firework size.
    • setSize

      public void setSize(float size)
      Sets the size of the firework.
      Parameters:
      size - the size along all axes.
    • setSize

      public void setSize(float x, float y, float z)
      Sets the size of the firework.
      Parameters:
      x - the size along x axis.
      y - the size along y axis.
      z - the size along z axis.
    • getStartColor

      public ColorRGBA getStartColor()
      Gets the start color of the firework.
      Returns:
      the firework start color.
    • setStartColor

      public void setStartColor(ColorRGBA color)
      Changes the start color of the firework.
      Parameters:
      color - the new color.
    • setStartColor

      public void setStartColor(float r, float g, float b, float a)
      Changes the start color of the firework.
      Parameters:
      r - the red component of the new color.
      g - the green component of the new color.
      b - the blue component of the new color.
      a - the alpha (transparency) component of the new color.
    • getEndColor

      public ColorRGBA getEndColor()
      Gets the end color of the firework.
      Returns:
      the firework end color.
    • setEndColor

      public void setEndColor(ColorRGBA color)
      Changes the end color of the firework.
      Parameters:
      color - the new color.
    • setEndColor

      public void setEndColor(float r, float g, float b, float a)
      Changes the end color of the firework.
      Parameters:
      r - the red component of the new color.
      g - the green component of the new color.
      b - the blue component of the new color.
      a - the alpha (transparency) component of the new color.
    • getColorIntensity

      public float getColorIntensity()
      Sets a color intensity factor (start and end color will be multiplied with this factor).
      Returns:
      the color intensity factor.
    • setColorIntensity

      public void setColorIntensity(float intensity)
      Changes the color intensity factor (start and end color will be multiplied with this factor).
      Parameters:
      intensity - the new intensity for the color.
    • getRelatedItem

      public WorldItem getRelatedItem()
      Gets the related item which caused this firework (e.g firework rocket). If this firework wasn't caused by an item, this function returns null.
      Returns:
      the item which caused this firework, or null if there is no related item.
    • getRelatedPlayer

      public Player getRelatedPlayer()
      Gets the player who is responsible for this firework. Returns null if this firework is not triggered by a player.
      Returns:
      the player who triggered this firework, or null if this firework 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 interface Cancellable
      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 interface Cancellable
      Parameters:
      cancel - set to true if you want to cancel this event.
      Example: Cancel "PlayerEnterAreaEvent", i.e prevent player from entering an area
      1//Listener class
      2public class PlayerListener implements Listener{
      3 @EventMethod
      4 public void onEnterArea(PlayerEnterAreaEvent evt){
      5 //Now the player will not be able to enter the area, i.e.
      6 //he will be teleported back to his old position (outside the area)
      7 evt.setCancelled(true);
      8 }
      9}