From ff5cd601665f6a4159e7e427d04deba643668074 Mon Sep 17 00:00:00 2001 From: Ryandw11 <6239385+ryandw11@users.noreply.github.com> Date: Mon, 8 Jul 2019 22:54:39 -0700 Subject: [PATCH] Did some work with the JSONBuilder Did some work with the JSONBuilder. Laid out the config for the JSON Component idea. --- config.yml | 20 +++++ src/me/ryandw11/ultrachat/api/JSON.java | 8 +- .../ultrachat/api/JSONChatBuilder.java | 77 +++++++++++++++++++ .../ultrachat/api/MessageBuilder.java | 53 +++++++++++++ 4 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 src/me/ryandw11/ultrachat/api/JSONChatBuilder.java create mode 100644 src/me/ryandw11/ultrachat/api/MessageBuilder.java diff --git a/config.yml b/config.yml index bdcd1f8..ad85733 100644 --- a/config.yml +++ b/config.yml @@ -39,6 +39,26 @@ Blocked_Words: - sh*t - asshole - fucker +############################################# +# JSON Component # +############################################# +# This is a system to create JSON pockets with in a message. +# It uses a placerholder system to use. +#The name of the component: +example: + #The base message of the component + Message: 'Example Message' + #The component events + Events: + #A click event {Optional} + Click: + # One and only one of the Click Operations. Full list includes: {Open_URL, Run_Command, Suggest_Command} + Open_URL: 'https://www.spigotmc.org/' + # When the player hovers over the base text. + Hover: + Show_Text: + - 'This is the first line' + - '&cThis is the second line' ############################################## # Chat Format Type # ############################################## diff --git a/src/me/ryandw11/ultrachat/api/JSON.java b/src/me/ryandw11/ultrachat/api/JSON.java index 9f8ce31..046884a 100644 --- a/src/me/ryandw11/ultrachat/api/JSON.java +++ b/src/me/ryandw11/ultrachat/api/JSON.java @@ -16,7 +16,13 @@ import net.md_5.bungee.api.chat.ComponentBuilder.FormatRetention; - +/** + * + * This class is deperecated. Use {@link JSONChatBuilder} with {@link MessageBuilder} instead. + * @deprecated + * @author Ryandw11 + * + */ public class JSON { //private UltraChat plugin; diff --git a/src/me/ryandw11/ultrachat/api/JSONChatBuilder.java b/src/me/ryandw11/ultrachat/api/JSONChatBuilder.java new file mode 100644 index 0000000..25fd76c --- /dev/null +++ b/src/me/ryandw11/ultrachat/api/JSONChatBuilder.java @@ -0,0 +1,77 @@ +package me.ryandw11.ultrachat.api; + +import java.util.List; + +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.ClickEvent; +import net.md_5.bungee.api.chat.ComponentBuilder; +import net.md_5.bungee.api.chat.HoverEvent; + +/** + * API to standardize JSONChatBuilding + *
To be used with the MessageBuilder {@link MessageBuilder}
+ * @author Ryandw11
+ * @since 2.4
+ *
+ */
+public class JSONChatBuilder {
+
+ private ComponentBuilder displayMessage;
+
+ public JSONChatBuilder(String displayMessage) {
+ this.displayMessage = new ComponentBuilder(displayMessage);
+ }
+
+ /**
+ * Add a hove message.
+ * @param lore Lore
+ */
+ public JSONChatBuilder setHoverShowText(List