- 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.
This commit is contained in:
Llm Dl committed 2019-12-11 16:41:02 -06:00
1 parent 802efbd3a7
commit 068b186df0
3 files changed
+9 -30

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
<groupId>com.palmergames.bukkit</groupId>
<artifactId>TownyChat</artifactId>
<packaging>jar</packaging>
<version>0.64</version>
<version>0.65</version>
<licenses>
<license>
+7 -1
View File
@@ -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.
- 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.
@@ -2,8 +2,6 @@ package com.palmergames.bukkit.TownyChat.Command.commandobjects;
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 class ChannelJoinAliasCommand extends BukkitCommand {
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: