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

public abstract class SettingProvider<T extends ConfigurationSerializable> extends Object
Base class for the provider classes.

See implementation to use them.

See Also:
  • Field Details

    • name

      protected final String name
      Name of the provider
    • description

      protected final String 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.
      Use SettingProvider(Class, String, String, String) and provide a localized name and description
      Create a new settings provider
      Parameters:
      clazz - which is returned by the provider
      name - 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.
      Use SettingProvider(Class, String, String, String) and provide a localized name and description
      Create a new settings provider
      Parameters:
      clazz - which is returned by the provider
      name - 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 provider
      name - name. Must be unique inside the provider.
      localizedName - The property key for the name
      description - A description. Might be a string or a property key
  • Method Details

    • isMatch

      public boolean isMatch(Arguments args)
      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

      public Class<? extends ConfigurationSerializable> serializationClass()
      class which will be returned by the provider.
      Returns:
      the class
    • parse

      public abstract T parse(Arguments args) throws CommandException
      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

      public Argument[] 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

      public String commandType()
      Returns the command type to use when building buttons. Will differ between suggesting and running a command.
      Returns:
      string to build command.
    • complete

      public abstract List<String> complete(Arguments args, Player player) throws CommandException
      Method to complete the arguments for the class provided by this provider
      Parameters:
      args - args to complete
      player - player which requests completion
      Returns:
      list of strings for the current argument
      Throws:
      CommandException
    • name

      public String name()
      Name of this provider
      Returns:
      unique name
    • localizedName

      public String localizedName()
    • defaultSetting

      public abstract T defaultSetting()
      Provides a default instance for this type
      Returns:
      instance of default setting
    • permission

      public String 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

      public boolean hasPermission(Permissible permissible)
      Checks if the Permissible can use this setting.
      Parameters:
      permissible - the permissible to check
      Returns:
      true if it has the permission.
    • description

      public String description()
      Provides a short description of the setting.
      Returns:
      the setting description
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • localizedDescription

      public String localizedDescription()