Class EnumSetting<T extends Enum<T>>
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.ItemSetting<String>
io.github.thebusybiscuit.slimefun4.api.items.settings.EnumSetting<T>
- Type Parameters:
T- TheEnumtype
This variation of
ItemSetting allows you to allow Enum constants to be
used for ItemSetting validation.- Author:
- TheBusyBiscuit
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionEnumSetting(SlimefunItem item, String key, Class<T> enumClass, T defaultValue) -
Method Summary
Modifier and TypeMethodDescriptionT[]This returns an array of validEnumvalues.This will attempt to get the configured value as a constant of the desiredEnum.protected StringThis is an error message which should provide further context on what values are allowed.booleanvalidateInput(String input) This method checks if a given input would be valid as a value for thisItemSetting.
-
Constructor Details
-
EnumSetting
@ParametersAreNonnullByDefault public EnumSetting(SlimefunItem item, String key, Class<T> enumClass, T defaultValue)
-
-
Method Details
-
getErrorMessage
Description copied from class:ItemSettingThis is an error message which should provide further context on what values are allowed.- Overrides:
getErrorMessagein classItemSetting<String>- Returns:
- An error message which is displayed when this
ItemSettingis misconfigured.
-
getAllowedValues
This returns an array of validEnumvalues. This method may be overridden to further limit the allowed values.- Returns:
- An array of allowed
Enumconstants
-
getAsEnumConstant
This will attempt to get the configured value as a constant of the desiredEnum.- Returns:
- The value as an
Enumconstant
-
validateInput
Description copied from class:ItemSettingThis method checks if a given input would be valid as a value for thisItemSetting. You can override this method to implement your own checks.- Overrides:
validateInputin classItemSetting<String>- Parameters:
input- The input value to validate- Returns:
- Whether the given input was valid
-