Package com.github.mafelp.utils
Class Settings
java.lang.Object
com.github.mafelp.utils.Settings
public class Settings
extends java.lang.Object
Class containing all settings:
[
Internal variables,
user defined values,
handling configuration files
]
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.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/applicationsprivate static org.bukkit.configuration.file.YamlConfiguration
configuration
The configuration which holds all configuration informationprivate static java.io.File
configurationFile
The file in which the configurations are specified inprivate static java.io.File
configurationFileDirectory
Directory where the configuration files are instatic boolean
debug
enables more information being displayed while executing eventsstatic org.javacord.api.DiscordApi
discordApi
communication API with Discord, defined in DiscordMain.init()static java.lang.String
discordCommandPrefix
The prefix used to identify commands in the discord chats.static org.bukkit.Server
minecraftServer
this minecraft server, defined in Main.onEnable()static java.lang.String
prefix
plugin prefix - optionally definable in config.yml - else defined in createDefaultConfig() - Used before log outputs in the consolestatic java.lang.String
serverName
Name of the server displayed in footer of discord messages defined in config.ymlstatic boolean
shortMsg
Use if message prefix should be one (true) or two (true) lines - optionally definable in config.yml - else defined in createDefaultConfig()static java.lang.String
version
version number of the plugin - displayed to users -
Constructor Summary
Constructors Constructor Description Settings()
-
Method Summary
Modifier and Type Method Description static java.lang.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
createDefaultConfig()
creates a default and template configuration to set as default and use when user didn't specify a value in config.ymlstatic java.lang.String
getApiToken()
Getter for the API Tokenstatic org.bukkit.configuration.file.YamlConfiguration
getConfiguration()
Getter for the configurationstatic java.io.File
getConfigurationFileDirectory()
Getter for the configurationFileDirectorystatic void
init()
Initializing method of the settings - initializes config and variablesstatic java.lang.String
msgPrefix(org.javacord.api.event.message.MessageCreateEvent event)
Creates a prefix for a minecraft messagestatic void
saveConfiguration()
saves the configuration (values) in "YamlConfiguration configuration" to the configuration fileMethods 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 discordApicommunication API with Discord, defined in DiscordMain.init() -
minecraftServer
public static volatile org.bukkit.Server minecraftServerthis minecraft server, defined in Main.onEnable() -
version
public static final java.lang.String versionversion number of the plugin - displayed to users- See Also:
- Constant Field Values
-
debug
public static boolean debugenables more information being displayed while executing events -
prefix
public static volatile java.lang.String prefixplugin prefix - optionally definable in config.yml - else defined in createDefaultConfig() - Used before log outputs in the console -
shortMsg
public static volatile boolean shortMsgUse if message prefix should be one (true) or two (true) lines - optionally definable in config.yml - else defined in createDefaultConfig() -
serverName
public static volatile java.lang.String serverNameName of the server displayed in footer of discord messages defined in config.yml -
API_TOKEN
private static java.lang.String API_TOKENAPI 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 java.lang.String discordCommandPrefixThe prefix used to identify commands in the discord chats. -
configurationFileDirectory
private static final java.io.File configurationFileDirectoryDirectory where the configuration files are in -
configurationFile
private static final java.io.File configurationFileThe file in which the configurations are specified in -
configuration
private static volatile org.bukkit.configuration.file.YamlConfiguration configurationThe configuration which holds all configuration information
-
-
Constructor Details
-
Settings
public Settings()
-
-
Method Details
-
msgPrefix
public static java.lang.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 java.lang.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 java.lang.String getApiToken()Getter for the API Token- Returns:
- discord bot API Token specified in the configuration
-
getConfigurationFileDirectory
public static java.io.File getConfigurationFileDirectory()Getter for the configurationFileDirectory- Returns:
- a File which contains the configuration file directory
-