forked from Minecraft/QoL
parent
1637e43bc8
commit
ab8d083b54
|
@ -1,20 +1,19 @@
|
||||||
package xyz.etztech.qol.listeners;
|
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.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.event.server.ServerCommandEvent;
|
import org.bukkit.event.server.ServerCommandEvent;
|
||||||
import xyz.etztech.core.CoreUtils;
|
import org.dynmap.DynmapAPI;
|
||||||
import xyz.etztech.core.web.CoreWeb;
|
import xyz.etztech.core.web.CoreWeb;
|
||||||
import xyz.etztech.qol.QoL;
|
import xyz.etztech.qol.QoL;
|
||||||
import xyz.etztech.qol.other.LinkCommand;
|
import xyz.etztech.qol.other.LinkCommand;
|
||||||
import org.dynmap.DynmapAPI;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -70,7 +69,9 @@ public class CommandPreprocessListener implements Listener {
|
||||||
visibleStatus = true;
|
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);
|
dynmap.setPlayerVisiblity(sender.getName(), visibleStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +98,8 @@ public class CommandPreprocessListener implements Listener {
|
||||||
//Add the user to the spec confirm map
|
//Add the user to the spec confirm map
|
||||||
confirmMap.put(sender.getUniqueId(), command);
|
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);
|
sender.spigot().sendMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +120,8 @@ public class CommandPreprocessListener implements Listener {
|
||||||
for (LinkCommand linkCommand : QoL.getLinks()) {
|
for (LinkCommand linkCommand : QoL.getLinks()) {
|
||||||
if (base.equalsIgnoreCase(linkCommand.getCommand())) {
|
if (base.equalsIgnoreCase(linkCommand.getCommand())) {
|
||||||
event.setCancelled(true);
|
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()));
|
link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, linkCommand.getUrl()));
|
||||||
sender.spigot().sendMessage(link);
|
sender.spigot().sendMessage(link);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue