From 0ca059d9fe0370410e0b0f35a6b1143ccf3df895 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Thu, 3 Feb 2022 15:20:06 -0600 Subject: [PATCH] - Display invalid subcommand message when /ch is used with an invalid subcommand. --- pom.xml | 2 +- resources/changelog.txt | 4 +++- .../bukkit/TownyChat/Command/ChannelCommand.java | 13 +++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 2745819..b019029 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.palmergames.bukkit TownyChat jar - 0.95 + 0.96 diff --git a/resources/changelog.txt b/resources/changelog.txt index 9f36bd5..a0f7413 100644 --- a/resources/changelog.txt +++ b/resources/changelog.txt @@ -399,4 +399,6 @@ v0.94: - Remove 2 unused replacers in TownyChatFormatter. - Switch to using Translatables, so messages appear in the correct Locale for each player. v0.95: - - Regression: channels.yml not handling /townychat reload, bug began in 0.92. \ No newline at end of file + - Regression: channels.yml not handling /townychat reload, bug began in 0.92. +v0.96: + - Display invalid subcommand message when /ch is used with an invalid subcommand. \ No newline at end of file diff --git a/src/com/palmergames/bukkit/TownyChat/Command/ChannelCommand.java b/src/com/palmergames/bukkit/TownyChat/Command/ChannelCommand.java index 70d2327..6db0f2a 100644 --- a/src/com/palmergames/bukkit/TownyChat/Command/ChannelCommand.java +++ b/src/com/palmergames/bukkit/TownyChat/Command/ChannelCommand.java @@ -88,14 +88,10 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor { } private void parseChannelCommand(Player player, String[] split) { - if (split.length == 0) { // So they just type /channel , We should probably send them to the help menu.. - for (String line : channel_help) { + // So they just type /channel , We should probably send them to the help menu.. + if (split.length == 0 || split[0].equalsIgnoreCase("help") || split[0].equalsIgnoreCase("?")) { + for (String line : channel_help) player.sendMessage(line); - } - } else if (split[0].equalsIgnoreCase("help") || split[0].equalsIgnoreCase("?")) { - for (String line : channel_help) { - player.sendMessage(line); - } } else if (split[0].equalsIgnoreCase("join")) { // /channel join [chn] (/label args[0] args[1] length = 2.) parseChannelJoin(player, StringMgmt.remFirstArg(split)); } else if (split[0].equalsIgnoreCase("leave")) { @@ -110,8 +106,9 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor { parseChannelList(player); } else if (split[0].equalsIgnoreCase("soundtoggle")) { parseChannelSoundToggle(player, StringMgmt.remFirstArg(split)); + } else { + TownyMessaging.sendErrorMsg(player, Translatable.of("msg_err_invalid_sub")); } - } public static void parseChannelList(Player player) {