Class SettingProvider<T extends ConfigurationSerializable>
java.lang.Object
de.eldoria.schematicbrush.brush.config.provider.SettingProvider<T>
- Type Parameters:
T- type of provided class. Must be of type ConfigurationSerializable
- Direct Known Subclasses:
ModifierProvider,SchematicSelectionProvider,SelectorProvider
Base class for the provider classes.
See implementation to use them.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSettingProvider(Class<? extends ConfigurationSerializable> clazz, String name) Deprecated, for removal: This API element is subject to removal in a future version.SettingProvider(Class<? extends ConfigurationSerializable> clazz, String name, String description) Deprecated, for removal: This API element is subject to removal in a future version.UseSettingProvider(Class, String, String, String)and provide a localized name and descriptionSettingProvider(Class<? extends ConfigurationSerializable> clazz, String name, String localizedName, String description) Create a new settings provider -
Method Summary
Modifier and TypeMethodDescriptionArgument[]Return the required and optional arguments to parse this setting.Returns the command type to use when building buttons.Method to complete the arguments for the class provided by this providerabstract TProvides a default instance for this typeProvides a short description of the setting.booleanbooleanDefines whether the provider requires arguments or not.inthashCode()booleanChecks if the provider requires a permissionbooleanhasPermission(Permissible permissible) Checks if thePermissiblecan use this setting.booleanChecks if the first argument matches the name.name()Name of this providerabstract TParse the arguments to the provided class if possibleReturns the permission for this setting.Class<? extends ConfigurationSerializable> class which will be returned by the provider.
-
Field Details
-
name
Name of the provider -
description
-
-
Constructor Details
-
SettingProvider
@Deprecated(forRemoval=true) public SettingProvider(Class<? extends ConfigurationSerializable> clazz, String name) Deprecated, for removal: This API element is subject to removal in a future version.UseSettingProvider(Class, String, String, String)and provide a localized name and descriptionCreate a new settings provider- Parameters:
clazz- which is returned by the providername- name. Must be unique inside the provider.
-
SettingProvider
@Deprecated(forRemoval=true) public SettingProvider(Class<? extends ConfigurationSerializable> clazz, String name, String description) Deprecated, for removal: This API element is subject to removal in a future version.UseSettingProvider(Class, String, String, String)and provide a localized name and descriptionCreate a new settings provider- Parameters:
clazz- which is returned by the providername- name. Must be unique inside the provider.description- A description. Might be a string or a property key
-
SettingProvider
public SettingProvider(Class<? extends ConfigurationSerializable> clazz, String name, String localizedName, String description) Create a new settings provider- Parameters:
clazz- which is returned by the providername- name. Must be unique inside the provider.localizedName- The property key for the namedescription- A description. Might be a string or a property key
-
-
Method Details
-
isMatch
Checks if the first argument matches the name.- Parameters:
args- arguments- Returns:
- true if the first argument is equal to the name, ignoring case.
-
serializationClass
class which will be returned by the provider.- Returns:
- the class
-
parse
Parse the arguments to the provided class if possible- Parameters:
args- args to parse- Returns:
- instance of the provided class
- Throws:
CommandException- if the arguments can't be parsed.
-
arguments
Return the required and optional arguments to parse this setting.- Returns:
- the arguments of the setting
-
hasArguments
public boolean hasArguments()Defines whether the provider requires arguments or not.- Returns:
- true if arguments are required
-
commandType
Returns the command type to use when building buttons. Will differ between suggesting and running a command.- Returns:
- string to build command.
-
complete
Method to complete the arguments for the class provided by this provider- Parameters:
args- args to completeplayer- player which requests completion- Returns:
- list of strings for the current argument
- Throws:
CommandException
-
name
Name of this provider- Returns:
- unique name
-
localizedName
-
defaultSetting
Provides a default instance for this type- Returns:
- instance of default setting
-
permission
Returns the permission for this setting.Leave blank when no permission is required.
- Returns:
- the permission
-
hasPermission
public boolean hasPermission()Checks if the provider requires a permission- Returns:
- true if a permission is required.
-
hasPermission
Checks if thePermissiblecan use this setting.- Parameters:
permissible- the permissible to check- Returns:
- true if it has the permission.
-
description
Provides a short description of the setting.- Returns:
- the setting description
-
equals
-
hashCode
public int hashCode() -
localizedDescription
-
SettingProvider(Class, String, String, String)and provide a localized name and description