Class ItemSetting<T>

    • Constructor Detail

      • ItemSetting

        public ItemSetting​(String key,
                           T defaultValue)
        This creates a new ItemSetting with the given key and default value
        Parameters:
        key - The key under which this setting will be stored (relative to the SlimefunItem)
        defaultValue - The default value for this ItemSetting
    • Method Detail

      • update

        public void update​(T newValue)
        This method updates this ItemSetting with the given value. Override this method to catch changes of a value. A value may never be null.
        Parameters:
        newValue - The new value for this ItemSetting
      • getKey

        public String getKey​()
        This returns the key of this ItemSetting.
        Returns:
        The key under which this setting is stored (relative to the SlimefunItem)
      • getValue

        public T getValue​()
        This returns the current value of this ItemSetting.
        Returns:
        The current value
      • getDefaultValue

        public T getDefaultValue​()
        This returns the default value of this ItemSetting.
        Returns:
        The default value
      • isType

        public boolean isType​(Class<?> c)
        This method checks if this ItemSetting stores the given data type.
        Parameters:
        c - The class of data type you want to compare
        Returns:
        Whether this ItemSetting stores the given type