From e15514291b18066efdc9d4cede400d6418446bef Mon Sep 17 00:00:00 2001 From: Arthur Mayer Date: Sun, 20 Feb 2011 19:49:05 +0100 Subject: [PATCH 1/2] only OPs can use fullrender. added response to chat for hide/show/fillrender commands. --- .../java/org/dynmap/DynmapPlayerListener.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/dynmap/DynmapPlayerListener.java b/src/main/java/org/dynmap/DynmapPlayerListener.java index be8b1788..b1e553ee 100644 --- a/src/main/java/org/dynmap/DynmapPlayerListener.java +++ b/src/main/java/org/dynmap/DynmapPlayerListener.java @@ -35,8 +35,10 @@ public class DynmapPlayerListener extends PlayerListener { mgr.touch(player.getLocation()); event.setCancelled(true); } else if (split[1].equals("hide")) { + Player player = event.getPlayer(); + player.sendMessage("You are now hidden on Dynmap."); if (split.length == 2) { - playerList.hide(event.getPlayer().getName()); + playerList.hide(player.getName()); } else { for (int i = 2; i < split.length; i++) { playerList.hide(split[i]); @@ -44,8 +46,10 @@ public class DynmapPlayerListener extends PlayerListener { } event.setCancelled(true); } else if (split[1].equals("show")) { + Player player = event.getPlayer(); + player.sendMessage("You are now visible on Dynmap."); if (split.length == 2) { - playerList.show(event.getPlayer().getName()); + playerList.show(player.getName()); } else { for (int i = 2; i < split.length; i++) { playerList.show(split[i]); @@ -54,8 +58,13 @@ public class DynmapPlayerListener extends PlayerListener { event.setCancelled(true); } else if (split[1].equals("fullrender")) { Player player = event.getPlayer(); - mgr.renderFullWorld(player.getLocation()); - event.setCancelled(true); + if (player.isOp() == true) { + player.sendMessage("Starting fullrender on this world..."); + mgr.renderFullWorld(player.getLocation()); + event.setCancelled(true); + } else { + player.sendMessage("Only OPs are allowed to use this command!"); + } } } } From 298c0f3391b7295b760d29e30de9f3ef17ed639a Mon Sep 17 00:00:00 2001 From: Arthur Mayer Date: Sun, 20 Feb 2011 20:06:07 +0100 Subject: [PATCH 2/2] corrected (hopefully) the chat response for show/hide commands --- src/main/java/org/dynmap/DynmapPlayerListener.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/dynmap/DynmapPlayerListener.java b/src/main/java/org/dynmap/DynmapPlayerListener.java index b1e553ee..9c01e86e 100644 --- a/src/main/java/org/dynmap/DynmapPlayerListener.java +++ b/src/main/java/org/dynmap/DynmapPlayerListener.java @@ -36,23 +36,25 @@ public class DynmapPlayerListener extends PlayerListener { event.setCancelled(true); } else if (split[1].equals("hide")) { Player player = event.getPlayer(); - player.sendMessage("You are now hidden on Dynmap."); - if (split.length == 2) { + if (split.length == 2) { playerList.hide(player.getName()); + player.sendMessage("You are now hidden on Dynmap."); } else { - for (int i = 2; i < split.length; i++) { + for (int i = 2; i < split.length; i++) { playerList.hide(split[i]); + player.sendMessage(split[i] + " is now hidden on Dynmap."); } } event.setCancelled(true); } else if (split[1].equals("show")) { Player player = event.getPlayer(); - player.sendMessage("You are now visible on Dynmap."); - if (split.length == 2) { + if (split.length == 2) { playerList.show(player.getName()); + player.sendMessage("You are now visible on Dynmap."); } else { - for (int i = 2; i < split.length; i++) { + for (int i = 2; i < split.length; i++) { playerList.show(split[i]); + player.sendMessage(split[i] + " is now visible on Dynmap."); } } event.setCancelled(true);