Class LapisCoreConfiguration


  • public class LapisCoreConfiguration
    extends java.lang.Object
    An utility class for dealing with config.yml and messages.yml files
    • Constructor Summary

      Constructors 
      Constructor Description
      LapisCoreConfiguration​(LapisCorePlugin core, int configVersion, int messagesVersion)
      Register the configurations and generate them
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String colorMessage​(java.lang.String msg)
      Colorize any string with color codes, this is used to support the p and s color codes that you might retrieve directly
      void generateConfigs()
      Generates the default configs from the plugin jar file Will not overwrite existing files, will only generate them if they don't exist
      java.lang.String getMessage​(java.lang.String key)
      Get a message from the messages.yml, This method will colorize the file when it is loaded
      java.lang.String getMessage​(java.lang.String key, org.bukkit.OfflinePlayer op)
      Overloaded getMessage(String) for dealing with placeholder API
      org.bukkit.configuration.file.YamlConfiguration getMessages()
      Get the messages.yml as a YamlConfiguration
      void reloadMessages()
      Reload the messages file into memory as the messages.yml
      java.lang.String replacePlaceholders​(java.lang.String s, org.bukkit.OfflinePlayer op)
      A utility method to replace placeholders from PAPI
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LapisCoreConfiguration

        public LapisCoreConfiguration​(LapisCorePlugin core,
                                      int configVersion,
                                      int messagesVersion)
        Register the configurations and generate them
        Parameters:
        core - The LapisCorePlugin that the files should be loaded for
        configVersion - The current config version for the config.yml
        messagesVersion - The current config version for the messages.yml
    • Method Detail

      • generateConfigs

        public void generateConfigs()
        Generates the default configs from the plugin jar file Will not overwrite existing files, will only generate them if they don't exist
      • reloadMessages

        public void reloadMessages()
        Reload the messages file into memory as the messages.yml
      • getMessages

        public org.bukkit.configuration.file.YamlConfiguration getMessages()
        Get the messages.yml as a YamlConfiguration
        Returns:
        Returns the messages.yml as a YamlConfiguration
      • getMessage

        public java.lang.String getMessage​(java.lang.String key)
        Get a message from the messages.yml, This method will colorize the file when it is loaded
        Parameters:
        key - The key in the messages.yml
        Returns:
        Returns a colorized string from the given key in the messages.yml
      • getMessage

        public java.lang.String getMessage​(java.lang.String key,
                                           org.bukkit.OfflinePlayer op)
        Overloaded getMessage(String) for dealing with placeholder API
        Parameters:
        key - The key in the messages.yml
        op - The player that this message will be sent too
        Returns:
        Returns a colorized string with placeholders replaced from the given key in the messages.yml
      • colorMessage

        public java.lang.String colorMessage​(java.lang.String msg)
        Colorize any string with color codes, this is used to support the p and s color codes that you might retrieve directly
        Parameters:
        msg - The string you wish to colorize
        Returns:
        Returns a colored string
      • replacePlaceholders

        public java.lang.String replacePlaceholders​(java.lang.String s,
                                                    org.bukkit.OfflinePlayer op)
        A utility method to replace placeholders from PAPI
        Parameters:
        s - The string to replace placeholders from
        op - The player that the messages are in relation to
        Returns:
        A string with papi placeholders replaced if PAPI is installed, otherwise returns s