Added messages when notifying the user they are entering spec.

master
Joey Hines 2018-10-15 17:07:01 -05:00
parent 7180b0982b
commit 6c5c20960b
1 changed files with 11 additions and 2 deletions

View File

@ -52,20 +52,29 @@ public class CommandPreprocessListener implements Listener {
DynmapAPI dynmap = (DynmapAPI) plugin.getDynmap(); DynmapAPI dynmap = (DynmapAPI) plugin.getDynmap();
// Spec dynmap hide // 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; boolean visibleStatus;
if (sender.getGameMode() != GameMode.SPECTATOR){ if (sender.getGameMode() != GameMode.SPECTATOR){
dynmapVisibleStatusMap.put(sender.getUniqueId(), dynmap.getPlayerVisbility(sender.getName())); dynmapVisibleStatusMap.put(sender.getUniqueId(), dynmap.getPlayerVisbility(sender.getName()));
visibleStatus = false; visibleStatus = false;
message = "You are now being hidden Dynmap.";
} }
else if (dynmapVisibleStatusMap.containsKey(sender.getUniqueId())){ else if (dynmapVisibleStatusMap.containsKey(sender.getUniqueId())){
visibleStatus = dynmapVisibleStatusMap.remove(sender.getUniqueId()); visibleStatus = dynmapVisibleStatusMap.remove(sender.getUniqueId());
String status = ((visibleStatus) ? "shown" : "hidden");
message = "Your " + status + " status has been restored on Dynmap.";
} }
else { else {
message = "You are now visible on the Dynmap.";
visibleStatus = true; visibleStatus = true;
} }
dynmap.setPlayerVisiblity(sender.getDisplayName(), visibleStatus); sender.spigot().sendMessage(new TextComponent(ChatColor.GREEN + message));
dynmap.setPlayerVisiblity(sender.getName(), visibleStatus);
} }
// Spec TP confirmation // Spec TP confirmation