Class SimplePropertyExpression<F,​T>

java.lang.Object
ch.njol.skript.lang.util.SimpleExpression<T>
ch.njol.skript.expressions.base.PropertyExpression<F,​T>
ch.njol.skript.expressions.base.SimplePropertyExpression<F,​T>
All Implemented Interfaces:
Converter<F,​T>, Debuggable, Expression<T>, SyntaxElement
Direct Known Subclasses:
ExprAI, ExprAltitude, ExprArmorSlot, ExprArrowKnockbackStrength, ExprArrowPierceLevel, ExprArrowsStuck, ExprAttackCooldown, ExprBalance, ExprBed, ExprBlockData, ExprBlockHardness, ExprBookAuthor, ExprBookTitle, ExprClientViewDistance, ExprCompassTarget, ExprCoordinate, ExprCreeperMaxFuseTicks, ExprCursorSlot, ExprCustomModelData, ExprDifficulty, ExprDurability, ExprEnchantmentOfferCost, ExprEnderChest, ExprEntityTamer, ExprExhaustion, ExprExplosiveYield, ExprEyeLocation, ExprFacing, ExprFallDistance, ExprFlightMode, ExprGlidingState, ExprGlowing, ExprGravity, ExprHighestSolidBlock, ExprHotbarSlot, ExprHumidity, ExprItemAmount, ExprItemFrameSlot, ExprLanguage, ExprLastAttacker, ExprLastColor, ExprLastDamage, ExprLastLoginTime, ExprLastResourcePackResponse, ExprLeashHolder, ExprLength, ExprLevel, ExprLevelProgress, ExprMaxDurability, ExprMaxHealth, ExprMaxMinecartSpeed, ExprMaxStack, ExprMiddleOfLocation, ExprMinecartDerailedFlyingVelocity, ExprName, ExprNoDamageTicks, ExprPing, ExprPlayerlistHeaderFooter, ExprPlayerWeather, ExprPrefixSuffix, ExprProjectileBounceState, ExprProjectileCriticalState, ExprRedstoneBlockPower, ExprRemainingAir, ExprSeaLevel, ExprSkull, ExprSlotIndex, ExprSpawnerType, ExprSpectatorTarget, ExprSpeed, ExprTemperature, ExprTimePlayed, ExprTimeSince, ExprTypeOf, ExprUnixDate, ExprUnixTicks, ExprUUID, ExprVectorLength, ExprVectorSquaredLength, ExprVectorXYZ, ExprVehicle, ExprVelocity, ExprYawPitch

public abstract class SimplePropertyExpression<F,​T> extends PropertyExpression<F,​T> implements Converter<F,​T>
A base class for property expressions that requires only few overridden methods
See Also:
PropertyExpression, PropertyExpression.register(Class, Class, String, String)
  • Constructor Details

    • SimplePropertyExpression

      public SimplePropertyExpression()
  • Method Details

    • init

      public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult)
      Description copied from interface: SyntaxElement
      Called just after the constructor.
      Specified by:
      init in interface SyntaxElement
      Parameters:
      exprs - all %expr%s included in the matching pattern in the order they appear in the pattern. If an optional value was left out it will still be included in this list holding the default value of the desired type which usually depends on the event.
      matchedPattern - The index of the pattern which matched
      isDelayed - Whether this expression is used after a delay or not (i.e. if the event has already passed when this expression will be called)
      parseResult - Additional information about the match.
      Returns:
      Whether this expression was initialised successfully. An error should be printed prior to returning false to specify the cause.
      See Also:
      ParserInstance.isCurrentEvent(Class...)
    • getPropertyName

      protected abstract String getPropertyName()
    • convert

      public abstract @Nullable T convert(F f)
      Description copied from interface: Converter
      Converts an object from the given to the desired type.
      Specified by:
      convert in interface Converter<F,​T>
      Parameters:
      f - The object to convert.
      Returns:
      the converted object
    • get

      protected T[] get(org.bukkit.event.Event e, F[] source)
      Description copied from class: PropertyExpression
      Converts the given source object(s) to the correct type.

      Please note that the returned array must neither be null nor contain any null elements!

      Specified by:
      get in class PropertyExpression<F,​T>
      Returns:
      An array of the converted objects, which may contain less elements than the source array, but must not be null.
      See Also:
      Converters.convert(Object[], Class, Converter)
    • toString

      public String toString(@Nullable org.bukkit.event.Event e, boolean debug)
      Specified by:
      toString in interface Debuggable
      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