var Enum
Creates a new scoreboard variable with the given name as player name. If no name is given, a random uuid is used.
This variable is used only to store enum values.
The enum type must be a subclass of Discriminant which implements the method Discriminant.discriminant returning a unique integer for each enum value.
Example:
enum class TestEnum(val value: Int) : Discriminant {
A(0), B(1), C(2);
override fun discriminant(): Int = value
}
val var1 = namespace.varEnum<TestEnum>("test")
namespace.onLoad {
if_(var1.eq(TestEnum.A)) {
cmd(var1.set(TestEnum.B))
}
}
Content copied to clipboard