Class SettingProvider<T>

java.lang.Object
de.eldoria.schematicbrush.brush.config.provider.SettingProvider<T>
Type Parameters:
T - type of provided class
Direct Known Subclasses:
ModifierProvider, SchematicSelectionProvider, SelectorProvider

public abstract class SettingProvider<T> 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

      public SettingProvider(String name, String localizedName, String description)
      Create a new settings provider
      Parameters:
      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.
    • 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
    • inputs

      public List<SettingInput> inputs(@Nullable T current)
      The inputs the dialog editor shows to enter the arguments of this setting.

      Defaults to one empty text input per argument. Override it to offer choices, toggles or numbers instead, and to start from the current value.

      Parameters:
      current - the current setting of the same type, which may come from another provider; null if none is set
      Returns:
      inputs in argument order
    • 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()