Class Settings

java.lang.Object
net.bonn2.modules.Module
net.bonn2.modules.settings.Settings

public class Settings extends Module
  • Constructor Details

    • Settings

      public Settings()
  • Method Details

    • getName

      public String getName()
      Overrides:
      getName in class Module
    • getVersion

      public String getVersion()
      Overrides:
      getVersion in class Module
    • registerLoggingChannels

      public void registerLoggingChannels()
      Specified by:
      registerLoggingChannels in class Module
    • registerSettings

      public void registerSettings()
      Specified by:
      registerSettings in class Module
    • load

      public void load()
      Specified by:
      load in class Module
    • getCommands

      public net.dv8tion.jda.api.interactions.commands.build.CommandData[] getCommands()
      Specified by:
      getCommands in class Module
    • register

      public static void register(@NotNull @NotNull Module module, String key, Setting.Type type, String unSet, String description)
    • getRegisteredSettings

      public static Map<String,Setting.Type> getRegisteredSettings(String module)
    • getDescriptions

      public static Map<String,String> getDescriptions(String module)
    • set

      public static boolean set(@NotNull @NotNull Module module, String guildID, String key, @NotNull @NotNull Setting value)
    • set

      public static boolean set(@NotNull @NotNull Module module, String guildID, String key, String value)
    • set

      public static boolean set(@NotNull @NotNull Module module, String guildID, String key, String value, boolean save)
    • unSet

      public static boolean unSet(@NotNull @NotNull Module module, String guildID, String key)
      Sets a Setting back to the default. As if it was never set.
      Parameters:
      module - The Module the Setting is registered to
      key - The key to reset
      Returns:
      True if Setting exists and was unset. (Will return true on repeat calls)
    • get

      public static Setting get(@NotNull @NotNull Module module, String guildID, String key)
      Get the value of a Setting, or a default value
      Parameters:
      module - The module the Setting is registered to
      key - The key to the Setting
      Returns:
      The Setting of the registered value, or an IntSetting of value 0 if unregistered
    • registeredSettingsCount

      public static int registeredSettingsCount(@NotNull @NotNull Module module)
    • hasSetting

      public static boolean hasSetting(@NotNull @NotNull Module module, String key)
      Check if a setting is registered
      Parameters:
      module - The module the setting is registered to
      key - The key to the setting
      Returns:
      True if the setting is registered, false if it isn't
    • getRegisteredSettingType

      public static Setting.Type getRegisteredSettingType(Module module, String key)
    • getSettings

      public static Set<String> getSettings(@NotNull @NotNull Module module)
      Returns a Set<String> of all the setting keys registered to a module
      Parameters:
      module - The module to check
      Returns:
      The Set<String> of settings registered