Class ItemSetting<T>
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.ItemSetting<T>
- Type Parameters:
T- The type of data stored under thisItemSetting
- Direct Known Subclasses:
DoubleRangeSetting,EnumSetting,GoldPanDrop,IntRangeSetting,MaterialTagSetting,TalismanEnchantment
This class represents a Setting for a
SlimefunItem that can be modified via
the Items.yml Config file.- Author:
- TheBusyBiscuit
-
Constructor Summary
ConstructorsConstructorDescriptionItemSetting(SlimefunItem item, String key, T defaultValue) This creates a newItemSettingwith the given key and default value -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanThis returns the default value of thisItemSetting.protected StringThis is an error message which should provide further context on what values are allowed.protected SlimefunItemgetItem()This returns the associatedSlimefunItemfor thisItemSetting.getKey()This returns the key of thisItemSetting.getValue()This returns the current value of thisItemSetting.final inthashCode()booleanThis method checks if thisItemSettingstores the given data type.voidreload()toString()voidThis method updates thisItemSettingwith the given value.booleanvalidateInput(T input) This method checks if a given input would be valid as a value for thisItemSetting.
-
Constructor Details
-
ItemSetting
This creates a newItemSettingwith the given key and default value- Parameters:
item- TheSlimefunItemthisItemSettingbelongs tokey- The key under which this setting will be stored (relative to theSlimefunItem)defaultValue- The default value for thisItemSetting
-
-
Method Details
-
validateInput
This method checks if a given input would be valid as a value for thisItemSetting. You can override this method to implement your own checks.- Parameters:
input- The input value to validate- Returns:
- Whether the given input was valid
-
update
This method updates thisItemSettingwith the given value. Override this method to catch changes of a value. A value may never be null.- Parameters:
newValue- The new value for thisItemSetting
-
getKey
This returns the key of thisItemSetting.- Returns:
- The key under which this setting is stored (relative to the
SlimefunItem)
-
getItem
This returns the associatedSlimefunItemfor thisItemSetting.- Returns:
- The associated
SlimefunItem
-
getValue
This returns the current value of thisItemSetting.- Returns:
- The current value
-
getDefaultValue
This returns the default value of thisItemSetting.- Returns:
- The default value
-
isType
This method checks if thisItemSettingstores the given data type.- Parameters:
c- The class of data type you want to compare- Returns:
- Whether this
ItemSettingstores the given type
-
getErrorMessage
This is an error message which should provide further context on what values are allowed.- Returns:
- An error message which is displayed when this
ItemSettingis misconfigured.
-
reload
public void reload() -
toString
-
hashCode
public final int hashCode() -
equals
-