Class Settings

java.lang.Object
com.github.mafelp.utils.Settings

public class Settings extends Object
Class containing all settings: [ Internal variables, user defined values, handling configuration files ]
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static String
    API token used to authenticate the bot to discord - defined in config.yml - token can be found on https://discord.com/developers/applications
    private static org.bukkit.configuration.file.YamlConfiguration
    The configuration which holds all configuration information
    private static File
    The file in which the configurations are specified in
    private static File
    Directory where the configuration files are in
    static boolean
    enables more information being displayed while executing events
    static org.javacord.api.DiscordApi
    communication API with Discord, defined in DiscordMain.init()
    static String
    The prefix used to identify commands in the discord chats.
    static org.bukkit.Server
    this minecraft server, defined in Main.onEnable()
    static String
    plugin prefix - optionally definable in config.yml - else defined in createDefaultConfig() - Used before log outputs in the console
    static String
    Name of the server displayed in footer of discord messages defined in config.yml
    static boolean
    Use if message prefix should be one (true) or two (true) lines - optionally definable in config.yml - else defined in createDefaultConfig()
    static String
    version number of the plugin - displayed to users
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    consoleMessagePrefix​(org.javacord.api.event.message.MessageCreateEvent event)
    Creates a prefix, without special characters, for a console message.
    static org.bukkit.configuration.file.YamlConfiguration
    creates a default and template configuration to set as default and use when user didn't specify a value in config.yml
    static String
    Getter for the API Token
    static org.bukkit.configuration.file.YamlConfiguration
    Getter for the configuration
    static File
    Getter for the configurationFileDirectory
    static void
    Initializing method of the settings - initializes config and variables
    static String
    msgPrefix​(org.javacord.api.event.message.MessageCreateEvent event)
    Creates a prefix for a minecraft message
    static void
    saves the configuration (values) in "YamlConfiguration configuration" to the configuration file

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • discordApi

      public static volatile org.javacord.api.DiscordApi discordApi
      communication API with Discord, defined in DiscordMain.init()
    • minecraftServer

      public static volatile org.bukkit.Server minecraftServer
      this minecraft server, defined in Main.onEnable()
    • version

      public static final String version
      version number of the plugin - displayed to users
      See Also:
      Constant Field Values
    • debug

      public static boolean debug
      enables more information being displayed while executing events
    • prefix

      public static volatile String prefix
      plugin prefix - optionally definable in config.yml - else defined in createDefaultConfig() - Used before log outputs in the console
    • shortMsg

      public static volatile boolean shortMsg
      Use if message prefix should be one (true) or two (true) lines - optionally definable in config.yml - else defined in createDefaultConfig()
    • serverName

      public static volatile String serverName
      Name of the server displayed in footer of discord messages defined in config.yml
    • API_TOKEN

      private static String API_TOKEN
      API token used to authenticate the bot to discord - defined in config.yml - token can be found on https://discord.com/developers/applications
    • discordCommandPrefix

      public static String discordCommandPrefix
      The prefix used to identify commands in the discord chats.
    • configurationFileDirectory

      private static final File configurationFileDirectory
      Directory where the configuration files are in
    • configurationFile

      private static final File configurationFile
      The file in which the configurations are specified in
    • configuration

      private static volatile org.bukkit.configuration.file.YamlConfiguration configuration
      The configuration which holds all configuration information
  • Constructor Details

    • Settings

      public Settings()
  • Method Details

    • msgPrefix

      public static String msgPrefix(org.javacord.api.event.message.MessageCreateEvent event)
      Creates a prefix for a minecraft message
      Parameters:
      event - Message create event made by the discord API containing information about the message and its source and author
      Returns:
      usable message prefix, one or two lines. two lines include unicode characters
    • consoleMessagePrefix

      public static String consoleMessagePrefix(org.javacord.api.event.message.MessageCreateEvent event)
      Creates a prefix, without special characters, for a console message.
      Parameters:
      event - Message create event made by the discord API containing information about the message and its source and author
      Returns:
      usable message prefix, one or two lines. two lines include unicode characters
    • init

      public static void init()
      Initializing method of the settings - initializes config and variables
    • createDefaultConfig

      public static org.bukkit.configuration.file.YamlConfiguration createDefaultConfig()
      creates a default and template configuration to set as default and use when user didn't specify a value in config.yml
      Returns:
      full configuration to set a default, when user didn't specify a value in config.yml
    • getConfiguration

      public static org.bukkit.configuration.file.YamlConfiguration getConfiguration()
      Getter for the configuration
      Returns:
      main configuration file
    • saveConfiguration

      public static void saveConfiguration()
      saves the configuration (values) in "YamlConfiguration configuration" to the configuration file
    • getApiToken

      public static String getApiToken()
      Getter for the API Token
      Returns:
      discord bot API Token specified in the configuration
    • getConfigurationFileDirectory

      public static File getConfigurationFileDirectory()
      Getter for the configurationFileDirectory
      Returns:
      a File which contains the configuration file directory