From ab8d083b5495ebcdbac6cce16b419886919d1fd6 Mon Sep 17 00:00:00 2001 From: Etzelia Date: Fri, 4 Oct 2019 16:46:39 -0500 Subject: [PATCH] Update to JSON text format Signed-off-by: Etzelia --- .../qol/listeners/CommandPreprocessListener.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java index fd7ef80..ad2e3e4 100644 --- a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java +++ b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java @@ -1,20 +1,19 @@ package xyz.etztech.qol.listeners; +import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.TextComponent; import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.server.ServerCommandEvent; -import xyz.etztech.core.CoreUtils; +import org.dynmap.DynmapAPI; import xyz.etztech.core.web.CoreWeb; import xyz.etztech.qol.QoL; import xyz.etztech.qol.other.LinkCommand; -import org.dynmap.DynmapAPI; import java.util.*; @@ -70,7 +69,9 @@ public class CommandPreprocessListener implements Listener { visibleStatus = true; } - sender.spigot().sendMessage(new TextComponent(ChatColor.GREEN + message)); + TextComponent textComponent = new TextComponent(message); + textComponent.setColor(ChatColor.GREEN); + sender.spigot().sendMessage(textComponent); dynmap.setPlayerVisiblity(sender.getName(), visibleStatus); } @@ -97,7 +98,8 @@ public class CommandPreprocessListener implements Listener { //Add the user to the spec confirm map confirmMap.put(sender.getUniqueId(), command); - TextComponent message = new TextComponent(ChatColor.GREEN + "You are running this command out of spec, run again to confirm."); + TextComponent message = new TextComponent("You are running this command out of spec, run again to confirm."); + message.setColor(ChatColor.GREEN); sender.spigot().sendMessage(message); } } @@ -118,7 +120,8 @@ public class CommandPreprocessListener implements Listener { for (LinkCommand linkCommand : QoL.getLinks()) { if (base.equalsIgnoreCase(linkCommand.getCommand())) { event.setCancelled(true); - TextComponent link = new TextComponent(ChatColor.GREEN + linkCommand.getMessage()); + TextComponent link = new TextComponent(linkCommand.getMessage()); + link.setColor(ChatColor.GREEN); link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, linkCommand.getUrl())); sender.spigot().sendMessage(link); return;