Package net.lapismc.lapiscore
Class LapisCoreConfiguration
- java.lang.Object
-
- net.lapismc.lapiscore.LapisCoreConfiguration
-
public class LapisCoreConfiguration extends java.lang.ObjectAn 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.StringcolorMessage(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 directlyvoidgenerateConfigs()Generates the default configs from the plugin jar file Will not overwrite existing files, will only generate them if they don't existjava.lang.StringgetMessage(java.lang.String key)Get a message from the messages.yml, This method will colorize the file when it is loadedjava.lang.StringgetMessage(java.lang.String key, org.bukkit.OfflinePlayer op)OverloadedgetMessage(String)for dealing with placeholder APIorg.bukkit.configuration.file.YamlConfigurationgetMessages()Get the messages.yml as aYamlConfigurationvoidreloadMessages()Reload the messages file into memory as the messages.ymljava.lang.StringreplacePlaceholders(java.lang.String s, org.bukkit.OfflinePlayer op)A utility method to replace placeholders from PAPI
-
-
-
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 forconfigVersion- The current config version for the config.ymlmessagesVersion- 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 aYamlConfiguration- 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)OverloadedgetMessage(String)for dealing with placeholder API- Parameters:
key- The key in the messages.ymlop- 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 fromop- The player that the messages are in relation to- Returns:
- A string with papi placeholders replaced if PAPI is installed, otherwise returns s
-
-