Package com.github.mafelp.utils
Class Settings
java.lang.Object
com.github.mafelp.utils.Settings
Class containing all settings:
[
Internal variables,
user defined values,
handling configuration files
]
-
Field Summary
Modifier and TypeFieldDescriptionprivate static String
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
The configuration which holds all configuration informationprivate static File
The file in which the configurations are specified inprivate static File
Directory where the configuration files are instatic boolean
enables more information being displayed while executing eventsstatic 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 consolestatic String
Name of the server displayed in footer of discord messages defined in config.ymlstatic 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
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.ymlstatic String
Getter for the API Tokenstatic org.bukkit.configuration.file.YamlConfiguration
Getter for the configurationstatic File
Getter for the configurationFileDirectorystatic void
init()
Initializing method of the settings - initializes config and variablesstatic String
msgPrefix(org.javacord.api.event.message.MessageCreateEvent event)
Creates a prefix for a minecraft messagestatic void
saves the configuration (values) in "YamlConfiguration configuration" to the configuration file
-
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
version 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
plugin 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
Name of the server displayed in footer of discord messages defined in config.yml -
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
The prefix used to identify commands in the discord chats. -
configurationFileDirectory
Directory where the configuration files are in -
configurationFile
The 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
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
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
Getter for the API Token- Returns:
- discord bot API Token specified in the configuration
-
getConfigurationFileDirectory
Getter for the configurationFileDirectory- Returns:
- a File which contains the configuration file directory
-