public interface Lang extends PluginFile
FileDataType
. This value should be usable with a Formatter and
is typically implemented through an enumModifier and Type | Method and Description |
---|---|
static String |
color(String color)
Converts pre-made strings to have chat colors in them
|
static Lang |
createLang(String format)
Returns a raw Lang object that can be used for dynamic creation of Lang
variables
|
static Lang |
defaultFormat(String option)
Returns a Lang object representing the default formatting for all
CodelanxLib plugins.
|
default String |
format(Object... args)
Formats a
Lang enum constant with the supplied arguments |
String |
getDefault()
The default value of this YAML string
|
Lang |
getFormat()
Returns the format specifier for this
Lang file. |
static Lang |
getFormat(org.bukkit.plugin.Plugin plugin)
Returns an acceptable message format for the plugin at hand
|
default String |
pluralFormat(int amount,
Object... args)
Will format a string with "PLURAL" or "PLURALA" tokens in them.
|
static void |
sendMessage(org.bukkit.command.CommandSender target,
Lang format,
Lang message,
Object... args)
Sends a message but does not include
getFormat() , instead it
uses a supplied format |
static void |
sendMessage(org.bukkit.command.CommandSender target,
Lang message,
Object... args)
Sends a formatted string and prepends the
getFormat() to
it. |
static void |
sendRawMessage(org.bukkit.command.CommandSender target,
Lang message,
Object... args)
Sends a raw message without additional formatting aside from translating
color codes
|
getConfig, getFileLocation, getPath, init, save, save
Lang getFormat()
Lang
file. This should be
a constant in the enum and represent a value that is used for all
messages universally.Lang
String getDefault()
getDefault
in interface PluginFile
default String format(Object... args)
Lang
enum constant with the supplied argumentsargs
- The arguments to supplydefault String pluralFormat(int amount, Object... args)
amount
- The amount representative of the data tokenargs
- The arguments to replace any other tokens with.static Lang createLang(String format)
static Lang defaultFormat(String option)
option
parameter can be supplemented
with null
which will default to "CL-Lib". The returned format is:
"&f[&9" + option == null ? "CL-Lib" : option + "&f] %amp;s"
option
- The optional "title" string for the formatLang
object representing the default formatstatic Lang getFormat(org.bukkit.plugin.Plugin plugin)
plugin
- A Plugin
that needs a formatLang
formatstatic String color(String color)
color
- String with un-converted color codesstatic void sendMessage(org.bukkit.command.CommandSender target, Lang message, Object... args)
getFormat()
to
it.target
- The target to send tomessage
- The message to colorize and sendargs
- Arguments to supply to the Lang
messagestatic void sendMessage(org.bukkit.command.CommandSender target, Lang format, Lang message, Object... args)
getFormat()
, instead it
uses a supplied formattarget
- The target to send toformat
- The format providedmessage
- The message to colorize and sendargs
- Arguments to supply to the Lang
messagestatic void sendRawMessage(org.bukkit.command.CommandSender target, Lang message, Object... args)
target
- The target to send tomessage
- The message to colorize and sendargs
- Arguments to supply to the Lang
messageCopyright © 2015. All rights reserved.