Class ExprMinMaxEnchantmentLevel

java.lang.Object
ch.njol.skript.lang.util.SimpleExpression<Integer>
ch.njol.skript.expressions.base.PropertyExpression<org.bukkit.enchantments.Enchantment, Integer>
ch.njol.skript.expressions.base.SimplePropertyExpression<org.bukkit.enchantments.Enchantment, Integer>
org.skriptlang.skript.bukkit.enchantments.elements.expressions.ExprMinMaxEnchantmentLevel
All Implemented Interfaces:
Debuggable, Expression<Integer>, Loopable<Integer>, Simplifiable<Expression<? extends Integer>>, SyntaxElement, Converter<org.bukkit.enchantments.Enchantment, Integer>, RuntimeErrorProducer, SyntaxRuntimeErrorProducer

@Name("Minimum/Maximum Enchantment Level") @Description("The minimum or maximum allowed level in Minecraft of a particular <a href='#enchantment'>enchantment</a>.\n\nThe minimum starting level is 1 for all existing enchantments as of 26.1.2.\n") @Example("set {_maximum} to the maximum enchantment level of sharpness\nif the level of sharpness of the player's tool is greater than {_maximum}:\n\tsend \"<gold>Your tool's sharpness level was capped out at the maximum allowed level.</gold>\"\n\tset the level of sharpness of the player's tool to {_maximum}\n") @Example("set {_min} to the minimum enchantment level of sharpness\nset {_max} to the maximum enchantment level of sharpness\nloop integers between {_min} and {_max}:\n\tset slot loop-counter of {_gui} to enchanted book named \"Sharpness %loop-value%\" with lore \"<reset>Click to enchant!\"\n") @Since("2.16") public class ExprMinMaxEnchantmentLevel extends ch.njol.skript.expressions.base.SimplePropertyExpression<org.bukkit.enchantments.Enchantment, Integer>
  • Constructor Details

    • ExprMinMaxEnchantmentLevel

      public ExprMinMaxEnchantmentLevel()
  • Method Details

    • register

      public static void register(SyntaxRegistry registry)
    • init

      public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult)
      Description copied from interface: SyntaxElement
      Called just after the constructor and SyntaxElement.preInit().
      Specified by:
      init in interface SyntaxElement
      Overrides:
      init in class ch.njol.skript.expressions.base.SimplePropertyExpression<org.bukkit.enchantments.Enchantment, Integer>
      Parameters:
      expressions - 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:
    • convert

      @Nullable public @Nullable Integer convert(org.bukkit.enchantments.Enchantment from)
      Description copied from interface: Converter
      Converts an object using this Converter.
      Specified by:
      convert in interface Converter<org.bukkit.enchantments.Enchantment, Integer>
      Specified by:
      convert in class ch.njol.skript.expressions.base.SimplePropertyExpression<org.bukkit.enchantments.Enchantment, Integer>
      Parameters:
      from - The object to convert.
      Returns:
      The converted object.
    • getReturnType

      public Class<? extends Integer> getReturnType()
      Description copied from interface: Expression
      Gets the return type of this expression.
      Returns:
      A supertype of any objects returned by Expression.getSingle(Event) and the component type of any arrays returned by Expression.getArray(Event)
    • getPropertyName

      protected String getPropertyName()
      Specified by:
      getPropertyName in class ch.njol.skript.expressions.base.SimplePropertyExpression<org.bukkit.enchantments.Enchantment, Integer>