From 7a234a1be67f3810241bc852e5d32a5198de00a8 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 5 Jan 2011 07:34:38 -0800 Subject: [PATCH] Fixed bug with silent toggle, cleaned up message informing players about /tpback --- vMinecraftCommands.java | 20 +++++++++++++++----- vMinecraftUsers.java | 7 +------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/vMinecraftCommands.java b/vMinecraftCommands.java index da315e4a0..882975b59 100644 --- a/vMinecraftCommands.java +++ b/vMinecraftCommands.java @@ -210,9 +210,17 @@ private static HashMap hidden = new HashMap(); } public static int silent(Player player, String[] args){ if(player.canUseCommand("/silent")){ - vMinecraftUsers.getProfile(player).setSilent(); - player.sendMessage(Colors.DarkPurple + "You are now silent"); - return EXIT_SUCCESS; + if(!vMinecraftUsers.getProfile(player).isSilent()){ + vMinecraftUsers.getProfile(player).setSilent(); + player.sendMessage(Colors.DarkPurple + "You are now silent... shh"); + return EXIT_SUCCESS; + } + if(vMinecraftUsers.getProfile(player).isSilent()){ + vMinecraftUsers.getProfile(player).disableSilent(); + player.sendMessage(Colors.DarkPurple + "You are no longer silent"); + return EXIT_SUCCESS; + } + return EXIT_FAIL; } return EXIT_FAIL; } @@ -1174,7 +1182,8 @@ private static HashMap hidden = new HashMap(); String xyz = x2+","+y2+","+z2; vMinecraftUsers.getProfile(player).setTpback(xyz); if(player.canUseCommand("/tpback")){ - player.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return."); + player.sendMessage(Colors.DarkPurple + "Your previous location has been stored"); + player.sendMessage(Colors.DarkPurple + "Use /tpback to return"); } if(!vMinecraftUsers.getProfile(player).isSilent()){ vMinecraftChat.gmsg( player, vMinecraftChat.getName(player) @@ -1270,7 +1279,8 @@ private static HashMap hidden = new HashMap(); vMinecraftUsers.getProfile(playerTarget).setTpback(xyz); if(playerTarget.canUseCommand("/tpback")) { - playerTarget.sendMessage(Colors.DarkPurple + "Your previous location has been stored, use /tpback to return."); + player.sendMessage(Colors.DarkPurple + "Your previous location has been stored"); + player.sendMessage(Colors.DarkPurple + "Use /tpback to return"); } } return EXIT_SUCCESS; diff --git a/vMinecraftUsers.java b/vMinecraftUsers.java index fc1eb3da0..cd5617a3e 100644 --- a/vMinecraftUsers.java +++ b/vMinecraftUsers.java @@ -517,12 +517,7 @@ class PlayerList silent = false; } public boolean isSilent(){ - if(silent == true){ - return true; - } - else { - return false; - } + return silent; } //Store the player's party public void setParty(String newParty)