From 0a677497d412d5c176f8713965ec3c95a7a1af1a Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 13 Jan 2011 20:27:28 +0000 Subject: [PATCH] Renamed Color -> ChatColor, and added DyeColor By: Dinnerbone --- .../org/bukkit/{Color.java => ChatColor.java} | 22 +++++----- .../src/main/java/org/bukkit/DyeColor.java | 44 +++++++++++++++++++ .../main/java/org/bukkit/fillr/Checker.java | 2 +- 3 files changed, 56 insertions(+), 12 deletions(-) rename paper-api/src/main/java/org/bukkit/{Color.java => ChatColor.java} (61%) create mode 100644 paper-api/src/main/java/org/bukkit/DyeColor.java diff --git a/paper-api/src/main/java/org/bukkit/Color.java b/paper-api/src/main/java/org/bukkit/ChatColor.java similarity index 61% rename from paper-api/src/main/java/org/bukkit/Color.java rename to paper-api/src/main/java/org/bukkit/ChatColor.java index f1bc64a2aa..990eb70697 100644 --- a/paper-api/src/main/java/org/bukkit/Color.java +++ b/paper-api/src/main/java/org/bukkit/ChatColor.java @@ -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 colors = new HashMap(); + private final static Map colors = new HashMap(); - 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); } } diff --git a/paper-api/src/main/java/org/bukkit/DyeColor.java b/paper-api/src/main/java/org/bukkit/DyeColor.java new file mode 100644 index 0000000000..f34de921b5 --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/DyeColor.java @@ -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 colors = new HashMap(); + + private DyeColor(final int data) { + this.data = data; + } + + public int getValue() { + return data; + } + + static { + for (DyeColor color : DyeColor.values()) { + colors.put(color.getValue(), color); + } + } +} diff --git a/paper-api/src/main/java/org/bukkit/fillr/Checker.java b/paper-api/src/main/java/org/bukkit/fillr/Checker.java index 8ae176bcfc..f00b136308 100644 --- a/paper-api/src/main/java/org/bukkit/fillr/Checker.java +++ b/paper-api/src/main/java/org/bukkit/fillr/Checker.java @@ -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!"); }