Module gomint.api

Class Gamerule<T>

  • Type Parameters:
    T - Type of the Gamerule. Can be Boolean, Integer or Float

    public final class Gamerule<T>
    extends Object
    Version:
    1.0
    Author:
    BlackyPaw
    • Method Detail

      • getByNbtName

        public static Gamerule getByNbtName​(String nbtName)
        Tries to find a gamerule given its NBT name.
        Parameters:
        nbtName - The NBT name of the gamerule
        Returns:
        The gamerule on success or null if no gamerule according to the NBT name was found
      • getNbtName

        public String getNbtName()
        Gets the name of the gamerule as it appears inside NBT files such as level.dat
        Returns:
        The name of the gamerule as it appears inside NBT files
      • getValueType

        public Class<?> getValueType()
        Gets the type of value this gamerule expects.
        Returns:
        The type of value this gamerule expects
      • createValueFromString

        public T createValueFromString​(String value)
        Creates a value of this gamerule's value type given the string representation of the value.
        Parameters:
        value - The value as a string
        Returns:
        The value of the gamerule in its appropriate type