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)
Automatically translates strings that contain color codes using the
'
& ' symbol |
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 |
default String |
formatAndColor(Object... args)
Formats a
Lang enum constant with the supplied arguments, and
colors it |
default String |
get()
Returns the string value used for this
Lang . |
String |
getDefault()
The default value of this
Lang string |
Lang |
getFormat()
Returns the format specifier for this
Lang file. |
static Lang |
getFormat(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 String |
proper(String raw)
Formats a string into either a proper word or sentence (First letter
capitalized, if spaces are included a period is added)
|
static String |
proper(String raw,
char punctuation)
Formats a string into either a proper word or sentence (First letter
capitalized, if spaces are included the supplied punctuation is added)
|
static void |
sendMessage(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(CommandSender target,
Lang message,
Object... args)
Sends a formatted string and prepends the
getFormat() to
it. |
static void |
sendMessage(OfflinePlayer target,
Lang format,
Lang message,
Object... args) |
static void |
sendMessage(OfflinePlayer target,
Lang message,
Object... args) |
static void |
sendMessage(Player target,
Lang format,
Lang message,
Object... args) |
static void |
sendMessage(Player target,
Lang message,
Object... args) |
static void |
sendRawMessage(CommandSender target,
Lang message,
Object... args)
Sends a raw message without additional formatting aside from translating
color codes
|
static void |
sendRawMessage(OfflinePlayer target,
Lang message,
Object... args) |
static void |
sendRawMessage(Player target,
Lang message,
Object... args) |
static void |
sendTitle(Player target,
Lang message,
Object... args)
Issues a "title" command to a
Player target with the passed Lang |
static void |
tellRaw(Player target,
Lang message,
Object... args)
Issues a "tellRaw" to a
Player target with the supplied Lang |
getConfig, getData, 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()
Lang
stringgetDefault
in interface PluginFile
default String get()
Lang
. Color codes
will not be automatically convertedget
in interface PluginFile
default String formatAndColor(Object... args)
Lang
enum constant with the supplied arguments, and
colors itargs
- The arguments to supplydefault 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(Plugin plugin)
static String color(String color)
&
' symbolcolor
- String with un-converted color codesstatic void sendMessage(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(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(CommandSender target, Lang message, Object... args)
target
- The target to send tomessage
- The message to colorize and sendargs
- Arguments to supply to the Lang
messagestatic void tellRaw(Player target, Lang message, Object... args)
Player
target with the supplied Langstatic void sendTitle(Player target, Lang message, Object... args)
Player
target with the passed Langstatic String proper(String raw)
raw
- The raw string to formatproper(String, char)
static String proper(String raw, char punctuation)
raw
- The raw string to formatpunctuation
- Punctuation to append to anything containing spacesstatic void sendMessage(OfflinePlayer target, Lang format, Lang message, Object... args)
static void sendMessage(OfflinePlayer target, Lang message, Object... args)
static void sendRawMessage(OfflinePlayer target, Lang message, Object... args)
Copyright © 2015. All rights reserved.