From 333282901f462f9d6c985877f5a73fbc5c6a0c3c Mon Sep 17 00:00:00 2001 From: Marco Cunha Date: Sat, 25 Aug 2012 22:35:30 +0200 Subject: [PATCH] Stop announcing new channels when it's the same channel --- .../palmergames/bukkit/TownyChat/Command/LeaveCommand.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/palmergames/bukkit/TownyChat/Command/LeaveCommand.java b/src/com/palmergames/bukkit/TownyChat/Command/LeaveCommand.java index 017ed07..289101c 100644 --- a/src/com/palmergames/bukkit/TownyChat/Command/LeaveCommand.java +++ b/src/com/palmergames/bukkit/TownyChat/Command/LeaveCommand.java @@ -86,7 +86,7 @@ public class LeaveCommand implements CommandExecutor { // Announce it TownyMessaging.sendMsg(sender, "[TownyChat] You left " + Colors.White + chan.getName()); - + // Find what the next channel is if any Channel nextChannel = null; if (plugin.getTowny().hasPlayerMode(player, chan.getName())) { if (plugin.getChannelsHandler().getDefaultChannel() != null && plugin.getChannelsHandler().getDefaultChannel().isPresent(player.getName())) { @@ -99,7 +99,9 @@ public class LeaveCommand implements CommandExecutor { if (nextChannel == null) { nextChannel = plugin.getChannelsHandler().getActiveChannel(player, channelTypes.GLOBAL); } - if (nextChannel != null) { + + // If the new channel is not us, announce it + if (nextChannel != null && !chan.getName().equalsIgnoreCase(nextChannel.getName())) { TownyMessaging.sendMsg(sender, "[TownyChat] You are now talking in " + Colors.White + nextChannel.getName()); }