Class GameEffect

java.lang.Object
org.skriptlang.skript.bukkit.particles.GameEffect

public class GameEffect extends Object
A class to hold metadata about Effects before playing.
  • Field Details

    • ENUM_UTILS

      public static final EnumParser<org.bukkit.Effect> ENUM_UTILS
  • Constructor Details

    • GameEffect

      public GameEffect(org.bukkit.Effect effect)
      Creates a new GameEffect with the given effect.
      Parameters:
      effect - the effect
  • Method Details

    • parse

      public static GameEffect parse(String input)
      Parses a GameEffect from the given input string. Prints errors if the parsed effect requires data.
      Parameters:
      input - the input string
      Returns:
      the parsed GameEffect, or null if the input is invalid
    • getEffect

      public org.bukkit.Effect getEffect()
      The backing Effect.
      Returns:
      the effect
    • getData

      @Nullable public @Nullable Object getData()
      The optional data for this effect.
      Returns:
      the data, or null if none is set (or not required)
    • setData

      public boolean setData(Object data)
      Sets the data for this effect. The data must be of the correct type for the effect.
      Parameters:
      data - the data to set. May only be null for the ELECTRIC_SPARK effect.
      Returns:
      true if the data was set correctly, false otherwise
    • draw

      public void draw(@NotNull @NotNull org.bukkit.Location location, @Nullable @Nullable Number radius)
      Plays the effect at the given location. The given location must have a world.
      Parameters:
      location - the location to play the effect at
      radius - the radius to play the effect in, or null to use the default radius
    • drawForPlayer

      public void drawForPlayer(org.bukkit.Location location, @NotNull @NotNull org.bukkit.entity.Player player)
      Plays the effect for the given player.
      Parameters:
      location - the location to play the effect at
      player - the player to play the effect for
    • toString

      public String toString(int flags)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getAllNamesWithoutData

      public static String[] getAllNamesWithoutData()
      Returns:
      an array of all effect names that do not require data.