From 408a5e00456233981c1dacc129c3235699e961ac Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 23 Sep 2018 17:19:22 -0500 Subject: [PATCH] Made changes based on the conversation of Issue #6. --- .../listeners/CommandPreprocessListener.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java index c405c5a..13aba4b 100644 --- a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java +++ b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java @@ -24,15 +24,9 @@ public class CommandPreprocessListener implements Listener { QoL plugin; private Map confirmTpMap = new HashMap<>(); private Map dynmapVisibleStatusMap = new HashMap<>(); - private DynmapAPI dynmap; public CommandPreprocessListener(QoL plugin) { this.plugin = plugin; - - if (plugin.getDynmap() != null) { - this.dynmap = plugin.getDynmap(); - } - } @EventHandler @@ -41,12 +35,13 @@ public class CommandPreprocessListener implements Listener { String command = event.getMessage(); String base = command.split(" ")[0].substring(1).toLowerCase(); // Strip the slash Player sender = event.getPlayer(); + DynmapAPI dynmap = plugin.getDynmap(); // Spec dynmap hide - if (base.equals("spec") && this.dynmap != null && sender.hasPermission("qol.audit")) { + if (base.equals("spec") && sender.hasPermission("SafeSpectate.spectate") && dynmap != null) { boolean visibleStatus; if (sender.getGameMode() != GameMode.SPECTATOR){ - dynmapVisibleStatusMap.put(sender.getUniqueId(), dynmap.getPlayerVisbility(sender.getDisplayName())); + dynmapVisibleStatusMap.put(sender.getUniqueId(), dynmap.getPlayerVisbility(sender.getName())); visibleStatus = false; } else if (dynmapVisibleStatusMap.containsKey(sender.getUniqueId())){ @@ -62,7 +57,7 @@ public class CommandPreprocessListener implements Listener { // Spec TP confirmation if (sender.hasPermission("qol.tpconfirm")) { //check if the command is a tp command - if (noSlash(base).equals("tp") || noSlash(base).startsWith("tele") || noSlash(command).toLowerCase().startsWith("lagg tpchunk")) { + if (noSlash(base).equals("tp") || noSlash(base).toLowerCase().startsWith("tele") || noSlash(command).toLowerCase().startsWith("lagg tpchunk")) { //If the user is in the confirm tp map, remove them and let the command run if (command.equals(confirmTpMap.get(sender.getUniqueId()))) { confirmTpMap.remove(sender.getUniqueId()); @@ -105,10 +100,6 @@ public class CommandPreprocessListener implements Listener { } } - if (noSlash(base).equals("spec")) { - - } - // Links for (LinkCommand linkCommand : QoL.getLinks()) { if (base.equalsIgnoreCase(linkCommand.getCommand())) {