Class Configuration

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

public class Configuration
extends java.lang.Object
The class that handles all the configuration tasks for servers and on a global level.
  • Field Summary

    Fields
    Modifier and Type Field Description
    static org.bukkit.configuration.file.YamlConfiguration config
    The global configuration.
    static java.io.File configurationFilesFolder
    The folder which houses all the sub folder with the server specific configurations, skribbl words, etc.
    static java.io.File globalConfigurationFile
    The configuration file which houses the global config.
    private static org.apache.logging.log4j.Logger logger
    The logging instance to log statements to the console and the log file.
    private static java.util.Map<org.javacord.api.entity.server.Server,​org.bukkit.configuration.file.YamlConfiguration> serverConfigurations
    A map of server configurations associated with their servers.
  • Constructor Summary

    Constructors
    Constructor Description
    Configuration()  
  • Method Summary

    Modifier and Type Method Description
    static org.bukkit.configuration.file.YamlConfiguration getServerConfiguration​(@NotNull org.javacord.api.entity.server.Server server)
    The method that return the server configuration which is in the map.
    static java.io.File getServerConfigurationFolder​(@NotNull org.javacord.api.entity.server.Server server)
    Method that gets the configuration folder of given server.
    static org.bukkit.configuration.file.YamlConfiguration load​(org.javacord.api.entity.server.Server server)
    Method to load a server configuration and put it into the map of server configurations.
    static void loadAll()
    Method that loads all the server configurations into memory.
    static void loadGlobalConfiguration()
    Method to load the global configuration into memory.
    static void save​(@NotNull org.javacord.api.entity.server.Server server, @NotNull org.bukkit.configuration.file.YamlConfiguration configurationToSave)
    The method that saves a server configuration.
    static void saveAll()
    The method to save all the server configurations to the disk.
    static void saveGlobalConfiguration()
    Method that saves the current global configuration to the disk.

    Methods inherited from class java.lang.Object

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

    • logger

      private static final org.apache.logging.log4j.Logger logger
      The logging instance to log statements to the console and the log file.
    • config

      public static org.bukkit.configuration.file.YamlConfiguration config
      The global configuration.
    • serverConfigurations

      private static final java.util.Map<org.javacord.api.entity.server.Server,​org.bukkit.configuration.file.YamlConfiguration> serverConfigurations
      A map of server configurations associated with their servers.
    • globalConfigurationFile

      public static java.io.File globalConfigurationFile
      The configuration file which houses the global config.
    • configurationFilesFolder

      public static java.io.File configurationFilesFolder
      The folder which houses all the sub folder with the server specific configurations, skribbl words, etc.
  • Constructor Details

    • Configuration

      public Configuration()
  • Method Details

    • loadGlobalConfiguration

      public static void loadGlobalConfiguration()
      Method to load the global configuration into memory.
    • load

      public static org.bukkit.configuration.file.YamlConfiguration load​(org.javacord.api.entity.server.Server server)
      Method to load a server configuration and put it into the map of server configurations.
      Parameters:
      server - The server to load the configuration from.
      Returns:
      The configuration that has been loaded.
    • loadAll

      public static void loadAll()
      Method that loads all the server configurations into memory.
    • saveGlobalConfiguration

      public static void saveGlobalConfiguration()
      Method that saves the current global configuration to the disk.
    • getServerConfigurationFolder

      public static java.io.File getServerConfigurationFolder​(@NotNull @NotNull org.javacord.api.entity.server.Server server)
      Method that gets the configuration folder of given server. This folder houses the configuration files, presents, skribbl words, etc.
      Parameters:
      server - The server to get the folder of.
      Returns:
      The file which is the server.
    • getServerConfiguration

      public static org.bukkit.configuration.file.YamlConfiguration getServerConfiguration​(@NotNull @NotNull org.javacord.api.entity.server.Server server)
      The method that return the server configuration which is in the map.
      Parameters:
      server - The server to get the configuration of.
      Returns:
      The server configuration of the server.
    • saveAll

      public static void saveAll()
      The method to save all the server configurations to the disk.
    • save

      public static void save​(@NotNull @NotNull org.javacord.api.entity.server.Server server, @NotNull @NotNull org.bukkit.configuration.file.YamlConfiguration configurationToSave)
      The method that saves a server configuration.
      Parameters:
      server - The server to save the configuration of.
      configurationToSave - The configuration to save.