public class BukkitLocalizable extends java.lang.Object implements Localizable
Modifier | Constructor and Description |
---|---|
protected |
BukkitLocalizable() |
Modifier and Type | Method and Description |
---|---|
void |
broadcast()
Broadcasts this message to all players on the server in their respective
locales.
|
void |
broadcast(Color color)
Broadcasts this message, prefixed by the given color, to all players on
the server in their respective
locales.
|
void |
broadcast(Color color,
java.lang.String... worlds)
Broadcasts this message, prefixed by the given color, to all players in
the given worlds.
|
void |
broadcast(java.lang.String... worlds)
Broadcasts this message to all players in the given worlds.
|
Localizable |
concat(Localizable localizable)
Concatenates this Localizable with another into a single new one.
|
Localizable |
concat(Localizable localizable,
java.lang.CharSequence separator)
Concatenates this Localizable with another into a single new one.
|
boolean |
equals(java.lang.Object otherLocalizable) |
java.lang.String |
getKey()
Gets the key associated with this
Localizable . |
Locale |
getParent()
Gets the parent
Locale of this message. |
java.lang.Object[] |
getReplacementSequences()
Returns an array of objects which will be used to replace wildcard
sequences, in respective order.
|
int |
hashCode() |
java.lang.String |
localize()
Attempts to localize this message based on the server's defined locale.
|
java.lang.String |
localize(java.lang.String locale)
Attempts to localize this message in the given locale.
|
java.lang.String |
localizeFor(MGPlayer player)
Attempts to localize this message for the given
MGPlayer . |
java.lang.String |
localizeFor(java.lang.String playerName)
Attempts to localize this message for the player with the given username.
|
java.lang.String |
localizeFor(java.util.UUID playerUuid)
Attempts to localize this message for the player with the given UUID.
|
void |
sendTo(java.lang.String playerName)
Attempts to localize this message for the player with the given username
and send it to them.
|
void |
sendTo(java.lang.String playerName,
Color color)
Attempts to localize this message for the player with the given username
and send it to them prefixed by the specified chat color.
|
void |
sendTo(java.util.UUID playerUuid)
Attempts to localize this message for the player with the given username
and send it to them.
|
void |
sendTo(java.util.UUID playerUuid,
Color color)
Attempts to localize this message for the player with the given UUID and
send it to them prefixed by the specified chat color.
|
public java.lang.String getKey()
Localizable
Localizable
.getKey
in interface Localizable
Localizable
public Locale getParent()
Localizable
Locale
of this message.getParent
in interface Localizable
Locale
of this messagepublic java.lang.Object[] getReplacementSequences()
Localizable
getReplacementSequences
in interface Localizable
public Localizable concat(Localizable localizable, java.lang.CharSequence separator)
Localizable
concat
in interface Localizable
localizable
- The Localizable to concatenateseparator
- The string to separate the two Localizables with. If
omitted, this will default to a space character.public Localizable concat(Localizable localizable)
Localizable
concat
in interface Localizable
localizable
- The Localizable to concatenatepublic java.lang.String localize()
Localizable
localize
in interface Localizable
public java.lang.String localize(java.lang.String locale)
Localizable
localize
in interface Localizable
locale
- The name of the locale to localize in. This should follow
the ISO 639-1 and ISO 3166-1 standards, respectively (e.g.
en_US or enUS).public java.lang.String localizeFor(java.lang.String playerName) throws java.lang.IllegalArgumentException
Localizable
localizeFor
in interface Localizable
playerName
- The username of the player to localize this message
for.java.lang.IllegalArgumentException
- If a player with the given username
cannot be foundpublic java.lang.String localizeFor(java.util.UUID playerUuid) throws java.lang.IllegalArgumentException
Localizable
localizeFor
in interface Localizable
playerUuid
- The UUID of the player to localize this message for.java.lang.IllegalArgumentException
- If a player with the given UUID cannot
be foundpublic java.lang.String localizeFor(MGPlayer player) throws java.lang.IllegalArgumentException
Localizable
MGPlayer
.localizeFor
in interface Localizable
player
- The MGPlayer
to localize this message forjava.lang.IllegalArgumentException
- If a player with the given username
cannot be foundpublic void sendTo(java.lang.String playerName) throws java.lang.IllegalArgumentException
Localizable
sendTo
in interface Localizable
playerName
- The username of the player to send the localized
message tojava.lang.IllegalArgumentException
- If a player with the given username
cannot be foundpublic void sendTo(java.lang.String playerName, Color color) throws java.lang.IllegalArgumentException
Localizable
sendTo
in interface Localizable
playerName
- The username of the player to send the localized
message tocolor
- The color to prefix the localized string withjava.lang.IllegalArgumentException
- If a player with the given username
cannot be foundpublic void sendTo(java.util.UUID playerUuid) throws java.lang.IllegalArgumentException
Localizable
sendTo
in interface Localizable
playerUuid
- The username of the player to send the localized
message tojava.lang.IllegalArgumentException
- If a player with the given username
cannot be foundpublic void sendTo(java.util.UUID playerUuid, Color color) throws java.lang.IllegalArgumentException
Localizable
sendTo
in interface Localizable
playerUuid
- The UUID of the player to send the localized message tocolor
- The color to prefix the localized string withjava.lang.IllegalArgumentException
- If a player with the given username
cannot be foundpublic void broadcast()
Localizable
broadcast
in interface Localizable
public void broadcast(Color color)
Localizable
broadcast
in interface Localizable
color
- The color to prefix the message withpublic void broadcast(java.lang.String... worlds)
Localizable
broadcast
in interface Localizable
worlds
- The names of the worlds to broadcast topublic void broadcast(Color color, java.lang.String... worlds)
Localizable
broadcast
in interface Localizable
color
- The color to prefix the message withworlds
- The names of the worlds to broadcast topublic boolean equals(java.lang.Object otherLocalizable)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object