From 068b186df049a05e7ffdd4e6bd6b188815ef9738 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Wed, 11 Dec 2019 16:41:02 -0600 Subject: [PATCH] v0.65: - Altered behaviour: - Previously using the channel command for the channel you're already speaking in would move you to the next default channel, or if non was found, the next global channel. - Ex: While being in townchat you use "/tc" you could find yourself in globalchat. - Now you will be told you're already in the channel you just used the command to enter into. --- pom.xml | 2 +- resources/changelog.txt | 8 ++++- .../ChannelJoinAliasCommand.java | 29 +------------------ 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/pom.xml b/pom.xml index 5d43063..84b9914 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.palmergames.bukkit TownyChat jar - 0.64 + 0.65 diff --git a/resources/changelog.txt b/resources/changelog.txt index 2620b83..64d72b7 100644 --- a/resources/changelog.txt +++ b/resources/changelog.txt @@ -281,4 +281,10 @@ v0.63: - Defaults to ops. - Bypasses spam check. v0.64: - - Removed "[Towny] Modes set: " line seen when a player changes channels. \ No newline at end of file + - Removed "[Towny] Modes set: " line seen when a player changes channels. +v0.65: + - Altered behaviour: + - Previously using the channel command for the channel you're already speaking in would move you to the next default channel, + or if non was found, the next global channel. + - Ex: While being in townchat you use "/tc" you could find yourself in globalchat. + - Now you will be told you're already in the channel you just used the command to enter into. \ No newline at end of file diff --git a/src/com/palmergames/bukkit/TownyChat/Command/commandobjects/ChannelJoinAliasCommand.java b/src/com/palmergames/bukkit/TownyChat/Command/commandobjects/ChannelJoinAliasCommand.java index 61a8de7..bb4833a 100644 --- a/src/com/palmergames/bukkit/TownyChat/Command/commandobjects/ChannelJoinAliasCommand.java +++ b/src/com/palmergames/bukkit/TownyChat/Command/commandobjects/ChannelJoinAliasCommand.java @@ -2,8 +2,6 @@ import com.palmergames.bukkit.TownyChat.Chat; import com.palmergames.bukkit.TownyChat.channels.Channel; -import com.palmergames.bukkit.TownyChat.channels.channelTypes; -import com.palmergames.bukkit.TownyChat.util.TownyUtil; import com.palmergames.bukkit.towny.TownyMessaging; import com.palmergames.bukkit.towny.TownySettings; import com.palmergames.bukkit.towny.TownyUniverse; @@ -30,38 +28,13 @@ public boolean execute(CommandSender commandSender, String label, String[] args) if (commandSender instanceof Player) { // So a player has ran some /g command or something if (channel.getCommands().contains(this.getName())) { // Should in theory always be true. final Player player = (Player) commandSender; - final Channel defaultChannel = plugin.getChannelsHandler().getDefaultChannel(); String message = ""; if (args.length > 0) { message = StringMgmt.join(args, " "); } if (message.isEmpty()) { if (plugin.getTowny().hasPlayerMode(player, channel.getName())) { - // Find what the next channel is if any - Channel nextChannel = null; - if (defaultChannel != null && defaultChannel.isPresent(player.getName())) { - nextChannel = defaultChannel; - if (!nextChannel.getName().equalsIgnoreCase(channel.getName())) { - TownyUtil.removeAndSetPlayerMode(plugin.getTowny(), player, channel.getName(), nextChannel.getName(), false); - } else { - // They're talking on default channel and want to leave but can't because they'll be put default again - // Their only option out is to leave the channel if they have permission to do so. - TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("tc_err_you_are_already_talking_in_default_channel_help")); - return true; - } - } else { - TownyUtil.removePlayerMode(plugin.getTowny(), player, channel.getName(), false); - } - - if (nextChannel == null) { - nextChannel = plugin.getChannelsHandler().getActiveChannel(player, channelTypes.GLOBAL); - } - - // If the new channel is not us, announce it - if (nextChannel != null && !channel.getName().equalsIgnoreCase(nextChannel.getName())) { - TownyMessaging.sendMsg(player, String.format(TownySettings.getLangString("tc_you_are_now_talking_in_channel"), nextChannel.getName())); - return true; - } + TownyMessaging.sendErrorMsg(player, String.format(TownySettings.getLangString("tc_you_are_already_in_channel"), channel.getName())); return true; } else { // You can join a channel if: