Class ExprDamageCause

java.lang.Object
ch.njol.skript.lang.util.SimpleExpression<T>
ch.njol.skript.expressions.base.EventValueExpression<org.bukkit.event.entity.EntityDamageEvent.DamageCause>
ch.njol.skript.expressions.ExprDamageCause
All Implemented Interfaces:
Debuggable, DefaultExpression<org.bukkit.event.entity.EntityDamageEvent.DamageCause>, Expression<org.bukkit.event.entity.EntityDamageEvent.DamageCause>, SyntaxElement

@Name("Damage Cause") @Description("The <a href=\'./classes.html#damagecause\'>damage cause</a> of a damage event. Please click on the link for more information.") @Examples("damage cause is lava, fire or burning") @Since("2.0") public class ExprDamageCause extends EventValueExpression<org.bukkit.event.entity.EntityDamageEvent.DamageCause>
  • Constructor Details

    • ExprDamageCause

      public ExprDamageCause()
  • Method Details

    • setTime

      public boolean setTime(int time)
      Description copied from class: SimpleExpression
      Sets the time of this expression, i.e. whether the returned value represents this expression before or after the event.

      This method will not be called if this expression is guaranteed to be used after a delay (an error will be printed immediately), but will be called if it only can be after a delay (e.g. if the preceding delay is in an if or a loop) as well as if there's no delay involved.

      If this method returns false the expression will be discarded and an error message is printed. Custom error messages must be of ErrorQuality.SEMANTIC_ERROR to be printed (NB: Skript.error(String) always creates semantic errors).

      This implementation sets the time but returns false.

      Specified by:
      setTime in interface Expression<org.bukkit.event.entity.EntityDamageEvent.DamageCause>
      Overrides:
      setTime in class EventValueExpression<org.bukkit.event.entity.EntityDamageEvent.DamageCause>
      Parameters:
      time - -1 for past or 1 for future. 0 is never passed to this method as it represents the default state.
      Returns:
      Whether this expression has distinct time states, e.g. a player never changes but a block can. This should be sensitive for the event (using ParserInstance.isCurrentEvent(Class)).
      See Also:
      SimpleExpression.setTime(int, Class, Expression...), SimpleExpression.setTime(int, Expression, Class...)
    • toString

      public String toString(@Nullable org.bukkit.event.Event e, boolean debug)
      Specified by:
      toString in interface Debuggable
      Overrides:
      toString in class EventValueExpression<org.bukkit.event.entity.EntityDamageEvent.DamageCause>
      Parameters:
      e - The event to get information to. This is always null if debug == false.
      debug - If true this should print more information, if false this should print what is shown to the end user
      Returns:
      String representation of this object