Class PlayerSetting<T>

java.lang.Object
me.gamercoder215.starcosmetics.api.player.PlayerSetting<T>
Type Parameters:
T - Setting Type

public final class PlayerSetting<T> extends Object
Represents a setting available to players.
  • Field Details

  • Method Details

    • getDefaultValue

      @NotNull public T getDefaultValue()
      Fetches the default value of this setting.
      Returns:
      Default Value
    • getId

      @NotNull public @NotNull String getId()
      Fetches the Setting's ID.
      Returns:
      Setting ID
    • getType

      @NotNull public @NotNull Class<T> getType()
      Fetches the Setting Type.
      Returns:
      Setting Type
    • getPossibleValues

      @NotNull public @NotNull List<T> getPossibleValues()
      Fetches all of the possible values for this setting.
      Returns:
      List of Possible Values
    • getSettingValue

      public static <T> T getSettingValue(@NotNull @NotNull Player p, @NotNull @NotNull PlayerSetting<T> setting) throws IllegalArgumentException
      Fetches the setting value off of a Player.
      Type Parameters:
      T - Setting Type
      Parameters:
      p - Player to fetch from
      setting - Setting to fetch
      Returns:
      Setting Value
      Throws:
      IllegalArgumentException - if player or setting is null
    • getDisplayName

      @NotNull public @NotNull String getDisplayName()
      Fetches the setting's display name.
      Returns:
      Setting Display Name
    • getDescription

      @NotNull public @NotNull String getDescription()
      Fetches the setting's description.
      Returns:
      Setting Description
    • values

      @NotNull public static @NotNull PlayerSetting<?>[] values()
      Creates an array of all of the Settings.
      Returns:
      Setting Values Array
    • byId

      @Nullable public static @Nullable PlayerSetting<?> byId(@Nullable @Nullable String id)
      Fetches a Setting by its ID.
      Parameters:
      id - Setting ID
      Returns:
      Setting
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object