From 3c2c676feb8de677fc89967657ebbf6e39d5484e Mon Sep 17 00:00:00 2001 From: tr7zw Date: Tue, 21 Apr 2020 14:00:11 +0200 Subject: [PATCH] Add EMC Add ChatColor.getById --- .../api/0034-EMC-Add-ChatColor.getById.patch | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 patches/api/0034-EMC-Add-ChatColor.getById.patch diff --git a/patches/api/0034-EMC-Add-ChatColor.getById.patch b/patches/api/0034-EMC-Add-ChatColor.getById.patch new file mode 100644 index 00000000..65118cd7 --- /dev/null +++ b/patches/api/0034-EMC-Add-ChatColor.getById.patch @@ -0,0 +1,51 @@ +From 96eb8c215c8b77800ac3d3b9959c5ff7b21eb0b3 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 24 Apr 2017 20:27:23 -0400 +Subject: [PATCH] EMC Add ChatColor.getById + +Bukkit has had a map of this for years and it was totally unused... +--- + src/main/java/org/bukkit/ChatColor.java | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java +index a0ef2a827..eb60aedba 100644 +--- a/src/main/java/org/bukkit/ChatColor.java ++++ b/src/main/java/org/bukkit/ChatColor.java +@@ -263,6 +263,15 @@ public enum ChatColor { + return net.md_5.bungee.api.ChatColor.RESET; + }; + ++ /** ++ * Gets the numeric ID associated with this color ++ * ++ * @return An int value of this color code ++ */ ++ public int getId() { ++ return intCode; ++ } ++ + /** + * Gets the char value associated with this color + * +@@ -296,6 +305,17 @@ public enum ChatColor { + return !isFormat && this != RESET; + } + ++ /** ++ * Gets the color represented by the specified color ID ++ * ++ * @param id Code to check ++ * @return Associative {@link org.bukkit.ChatColor} with the given id, ++ * or null if it doesn't exist ++ */ ++ public static ChatColor getById(int id) { ++ return BY_ID.get(id); ++ } ++ + /** + * Gets the color represented by the specified color code + * +-- +2.25.1.windows.1 +