Renamed Color -> ChatColor, and added DyeColor

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-01-13 20:27:28 +00:00
parent 1a6e8ac5eb
commit 0a677497d4
3 changed files with 56 additions and 12 deletions

View file

@ -4,9 +4,9 @@ import java.util.HashMap;
import java.util.Map;
/**
* All supported color values
* All supported color values for chat
*/
public enum Color {
public enum ChatColor {
BLACK(0x0),
DARK_BLUE(0x1),
DARK_GREEN(0x2),
@ -17,17 +17,17 @@ public enum Color {
GRAY(0x7),
DARK_GRAY(0x8),
BLUE(0x9),
GREEN(0xa),
AQUA(0xb),
RED(0xc),
LIGHT_PURPLE(0xd),
YELLOW(0xe),
WHITE(0xf);
GREEN(0xA),
AQUA(0xB),
RED(0xC),
LIGHT_PURPLE(0xD),
YELLOW(0xE),
WHITE(0xF);
private final int code;
private final static Map<Integer, Color> colors = new HashMap<Integer, Color>();
private final static Map<Integer, ChatColor> colors = new HashMap<Integer, ChatColor>();
private Color(final int code) {
private ChatColor(final int code) {
this.code = code;
}
@ -41,7 +41,7 @@ public enum Color {
}
static {
for (Color color : Color.values()) {
for (ChatColor color : ChatColor.values()) {
colors.put(color.getCode(), color);
}
}

View file

@ -0,0 +1,44 @@
package org.bukkit;
import java.util.HashMap;
import java.util.Map;
/**
* All supported color values for dyes and cloth
*/
public enum DyeColor {
BLACK(0x0),
RED(0x1),
GREEN(0x2),
BROWN(0x3),
BLUE(0x4),
PURPLE(0x5),
CYAN(0x6),
SILVER(0x7),
GRAY(0x8),
PINK(0x9),
LIME(0xA),
YELLOW(0xB),
LIGHT_BLUE(0xC),
MAGENTA(0xD),
ORANGE(0xE),
WHITE(0xF);
private final int data;
private final static Map<Integer, DyeColor> colors = new HashMap<Integer, DyeColor>();
private DyeColor(final int data) {
this.data = data;
}
public int getValue() {
return data;
}
static {
for (DyeColor color : DyeColor.values()) {
colors.put(color.getValue(), color);
}
}
}

View file

@ -43,7 +43,7 @@ public class Checker {
PluginDescriptionFile pdfFile = Checker.getPDF(file);
FillReader reader = needsUpdate(pdfFile);
if (reader != null) {
player.sendMessage(Color.RED + reader.getName() + " " + pdfFile.getVersion() + " has an update to " + reader.getCurrVersion());
player.sendMessage(ChatColor.RED + reader.getName() + " " + pdfFile.getVersion() + " has an update to " + reader.getCurrVersion());
} else {
player.sendMessage(pdfFile.getName() + " " + pdfFile.getVersion() + " is up to date!");
}