mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-27 20:59:12 +01:00
#2858: ChatColor#ordinal is missing
This commit is contained in:
parent
75af27acf1
commit
739b496bf6
@ -121,12 +121,17 @@ public final class ChatColor
|
||||
* Resets all previous chat colors or formats.
|
||||
*/
|
||||
public static final ChatColor RESET = new ChatColor( 'r', "reset" );
|
||||
/**
|
||||
* Count used for populating legacy ordinal.
|
||||
*/
|
||||
private static int count = 0;
|
||||
/**
|
||||
* This colour's colour char prefixed by the {@link #COLOR_CHAR}.
|
||||
*/
|
||||
private final String toString;
|
||||
@Getter
|
||||
private final String name;
|
||||
private final int ordinal;
|
||||
|
||||
private ChatColor(char code, String name)
|
||||
{
|
||||
@ -135,6 +140,7 @@ public final class ChatColor
|
||||
{
|
||||
COLOR_CHAR, code
|
||||
} );
|
||||
this.ordinal = count++;
|
||||
|
||||
BY_CHAR.put( code, this );
|
||||
BY_NAME.put( name.toUpperCase( Locale.ROOT ), this );
|
||||
@ -144,6 +150,7 @@ public final class ChatColor
|
||||
{
|
||||
this.name = name;
|
||||
this.toString = toString;
|
||||
this.ordinal = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -294,4 +301,17 @@ public final class ChatColor
|
||||
{
|
||||
return getName().toUpperCase( Locale.ROOT );
|
||||
}
|
||||
|
||||
/**
|
||||
* See {@link Enum#ordinal()}.
|
||||
*
|
||||
* @return ordinal
|
||||
* @deprecated holdover from when this class was an enum
|
||||
*/
|
||||
@Deprecated
|
||||
public int ordinal()
|
||||
{
|
||||
Preconditions.checkArgument( ordinal >= 0, "Cannot get ordinal of hex color" );
|
||||
return ordinal;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user