From 8dfea2032f335be890a35a3e14c1d8bc964327ed Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Tue, 15 Nov 2016 22:34:50 +0100 Subject: [PATCH] Moved everything for Channel.java --- .../java/buttondevteam/lib/chat/Channel.java | 36 +++++++++++++++++++ .../java/buttondevteam/lib/chat/Color.java | 19 ++++++++++ .../java/buttondevteam/lib/chat/Format.java | 24 +++++++++++++ .../java/buttondevteam/lib/chat/Priority.java | 14 ++++++++ .../buttondevteam/lib/chat/TBMCChatAPI.java | 5 +++ .../lib/chat/TellrawSerializableEnum.java | 5 +++ 6 files changed, 103 insertions(+) create mode 100644 src/main/java/buttondevteam/lib/chat/Channel.java create mode 100644 src/main/java/buttondevteam/lib/chat/Color.java create mode 100644 src/main/java/buttondevteam/lib/chat/Format.java create mode 100644 src/main/java/buttondevteam/lib/chat/Priority.java create mode 100644 src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java diff --git a/src/main/java/buttondevteam/lib/chat/Channel.java b/src/main/java/buttondevteam/lib/chat/Channel.java new file mode 100644 index 0000000..5a257a4 --- /dev/null +++ b/src/main/java/buttondevteam/lib/chat/Channel.java @@ -0,0 +1,36 @@ +package buttondevteam.lib.chat; + +import java.util.ArrayList; +import java.util.List; + +public class Channel { + public final String DisplayName; + public final Color color; + public final String Command; + + private static List channels = new ArrayList<>(); + + public Channel(String displayname, Color color, String command) { + DisplayName = displayname; + this.color = color; + Command = command; + } + + static { + channels.add(GlobalChat = new Channel("§fg§f", Color.White, "g")); + channels.add(TownChat = new Channel("§3TC§f", Color.DarkAqua, "tc")); + channels.add(NationChat = new Channel("§6NC§f", Color.Gold, "nc")); + channels.add(AdminChat = new Channel("§cADMIN§f", Color.Red, "a")); + channels.add(ModChat = new Channel("§9MOD§f", Color.Blue, "mod")); + } + + public static List getChannels() { + return channels; + } + + public static Channel GlobalChat; + public static Channel TownChat; + public static Channel NationChat; + public static Channel AdminChat; + public static Channel ModChat; +} diff --git a/src/main/java/buttondevteam/lib/chat/Color.java b/src/main/java/buttondevteam/lib/chat/Color.java new file mode 100644 index 0000000..7849f98 --- /dev/null +++ b/src/main/java/buttondevteam/lib/chat/Color.java @@ -0,0 +1,19 @@ +package buttondevteam.lib.chat; + +public enum Color implements TellrawSerializableEnum { + Black("black"), DarkBlue("dark_blue"), DarkGreen("dark_green"), DarkAqua("dark_aqua"), DarkRed( + "dark_red"), DarkPurple("dark_purple"), Gold("gold"), Gray("gray"), DarkGray("dark_gray"), Blue( + "blue"), Green("green"), Aqua("aqua"), Red( + "red"), LightPurple("light_purple"), Yellow("yellow"), White("white"), RPC("rpc"); + + private String name; + + Color(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } +} \ No newline at end of file diff --git a/src/main/java/buttondevteam/lib/chat/Format.java b/src/main/java/buttondevteam/lib/chat/Format.java new file mode 100644 index 0000000..b13d45b --- /dev/null +++ b/src/main/java/buttondevteam/lib/chat/Format.java @@ -0,0 +1,24 @@ +package buttondevteam.lib.chat; + +public enum Format implements TellrawSerializableEnum { + Bold("bold"), Underlined("underlined"), Italic("italic"), Strikethrough("strikethrough"), Obfuscated( + "obfuscated"); + // TODO: Add format codes to /u c + private String name; + + Format(String name) { + this.name = name; + this.flag = 1 << this.ordinal(); + } + + @Override + public String getName() { + return name; + } + + private final int flag; + + public int getFlag() { + return flag; + } +} \ No newline at end of file diff --git a/src/main/java/buttondevteam/lib/chat/Priority.java b/src/main/java/buttondevteam/lib/chat/Priority.java new file mode 100644 index 0000000..2a2f18f --- /dev/null +++ b/src/main/java/buttondevteam/lib/chat/Priority.java @@ -0,0 +1,14 @@ +package buttondevteam.lib.chat; + +public enum Priority { + Low(0), Normal(1), High(2); + private int val; + + Priority(int v) { + val = v; + } + + public int GetValue() { + return val; + } +} diff --git a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java index 6df5ab4..4d58544 100644 --- a/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java +++ b/src/main/java/buttondevteam/lib/chat/TBMCChatAPI.java @@ -6,6 +6,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Set; +import org.bukkit.command.CommandSender; import org.bukkit.plugin.java.JavaPlugin; import org.reflections.Reflections; import org.reflections.scanners.SubTypesScanner; @@ -160,4 +161,8 @@ public class TBMCChatAPI { } return true; } + + public static void SendChatMessage(Channel channel, CommandSender sender, String message) { + // TODO + } } diff --git a/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java b/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java new file mode 100644 index 0000000..1b10963 --- /dev/null +++ b/src/main/java/buttondevteam/lib/chat/TellrawSerializableEnum.java @@ -0,0 +1,5 @@ +package buttondevteam.lib.chat; + +public interface TellrawSerializableEnum { + public String getName(); +}