Minimum/Maximum Enchantment Level (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.16

Syntax

[the] ((max|min)[imum]|starting) enchant[ment] level [of %enchantments%]

Description

The minimum or maximum allowed level in Minecraft of a particular <a href='#enchantment'>enchantment</a>.

The minimum starting level is 1 for all existing enchantments as of 26.1.2.

Examples

set {_maximum} to the maximum enchantment level of sharpness
if the level of sharpness of the player's tool is greater than {_maximum}:
	send "<gold>Your tool's sharpness level was capped out at the maximum allowed level.</gold>"
	set the level of sharpness of the player's tool to {_maximum}
set {_min} to the minimum enchantment level of sharpness
set {_max} to the maximum enchantment level of sharpness
loop integers between {_min} and {_max}:
	set slot loop-counter of {_gui} to enchanted book named "Sharpness %loop-value%" with lore "<reset>Click to enchant!"

View source