From 6c5c20960b782d6b922d31859baca01132c63b9f Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Mon, 15 Oct 2018 17:07:01 -0500 Subject: [PATCH] Added messages when notifying the user they are entering spec. --- .../qol/listeners/CommandPreprocessListener.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java index e626b6f..05f4c47 100644 --- a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java +++ b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java @@ -52,20 +52,29 @@ public class CommandPreprocessListener implements Listener { DynmapAPI dynmap = (DynmapAPI) plugin.getDynmap(); // Spec dynmap hide - if (base.equals("spec") && sender.hasPermission("SafeSpectate.spectate") && dynmap != null) { + if (base.equals("spec") && sender.hasPermission("safespectate.spectate") && dynmap != null) { + String message; boolean visibleStatus; if (sender.getGameMode() != GameMode.SPECTATOR){ dynmapVisibleStatusMap.put(sender.getUniqueId(), dynmap.getPlayerVisbility(sender.getName())); visibleStatus = false; + + message = "You are now being hidden Dynmap."; + } else if (dynmapVisibleStatusMap.containsKey(sender.getUniqueId())){ visibleStatus = dynmapVisibleStatusMap.remove(sender.getUniqueId()); + + String status = ((visibleStatus) ? "shown" : "hidden"); + message = "Your " + status + " status has been restored on Dynmap."; } else { + message = "You are now visible on the Dynmap."; visibleStatus = true; } - dynmap.setPlayerVisiblity(sender.getDisplayName(), visibleStatus); + sender.spigot().sendMessage(new TextComponent(ChatColor.GREEN + message)); + dynmap.setPlayerVisiblity(sender.getName(), visibleStatus); } // Spec TP confirmation