Merge pull request #50 from TownyAdvanced/fix/help_menu_colours

Fix help menus not being coloured properly.
This commit is contained in:
LlmDl authored and GitHub committed 2023-07-20 09:44:05 -05:00
commit 6152de8760
4 files changed
+12 -16

No files matched your search

@@ -80,7 +80,7 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
} else {
// Console
for (String line : channel_help) {
sender.sendMessage(Colors.strip(line));
TownyMessaging.sendMessage(sender, Colors.strip(line));
return true;
}
}
@@ -91,7 +91,7 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
// 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);
TownyMessaging.sendMessage(player, 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")) {
@@ -130,7 +130,7 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
public static void parseChannelMuteList(Player player, String[] split) {
if (split.length == 0) {
for (String line : channel_help) {
player.sendMessage(line);
TownyMessaging.sendMessage(player, line);
}
return;
}
@@ -194,7 +194,7 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
public static void parseChannelMute(Player player, String[] split, boolean mute) {
if (split.length < 2) {
for (String line : channel_help) {
player.sendMessage(line);
TownyMessaging.sendMessage(player, line);
}
return;
}
@@ -277,7 +277,7 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
public static void parseChannelLeave(Player player, String[] split) {
if (split.length == 0) {
for (String line : channel_help) {
player.sendMessage(line);
TownyMessaging.sendMessage(player, line);
}
return;
}
@@ -341,7 +341,7 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
public static void parseChannelJoin(Player player, String[] split) {
if (split.length == 0) {
for (String line : channel_help) {
player.sendMessage(line);
TownyMessaging.sendMessage(player, line);
}
return;
}
@@ -390,7 +390,7 @@ public class ChannelCommand extends BaseCommand implements CommandExecutor {
public static void parseChannelSoundToggle(Player player, String[] split) {
if (split.length == 0) {
for (String line : channel_help) {
player.sendMessage(line);
TownyMessaging.sendMessage(player, line);
}
return;
}
@@ -43,13 +43,9 @@ public class TownyChatCommand extends BaseCommand implements CommandExecutor {
}
private void parseTownyChatCommand(CommandSender sender, String[] split) {
if (split.length == 0) { // 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 : townychat_help) {
sender.sendMessage(line);
}
} else if (split[0].equalsIgnoreCase("help") || split[0].equalsIgnoreCase("?")) {
for (String line : townychat_help) {
sender.sendMessage(line);
TownyMessaging.sendMessage(sender, line);
}
} else if (split[0].equalsIgnoreCase("reload")) {
plugin.reload();
@@ -88,7 +88,7 @@ public class ChannelJoinAliasCommand extends BukkitCommand {
}
return true;
} else {
commandSender.sendMessage("You may not use this command as the console!");
TownyMessaging.sendMsg("You may not use this command as the console!");
return false;
}
}
@@ -192,7 +192,7 @@ public class StandardChannel extends Channel {
private void trySendingAloneMessage(Player sender, Set<Player> recipients) {
if (ChatSettings.isUsingAloneMessage() &&
recipients.stream().filter(p -> sender.canSee(p)).count() < 2) // sender will usually be a recipient of their own message.
sender.sendMessage(Colors.translateColorCodes(ChatSettings.getUsingAloneMessageString()));
TownyMessaging.sendMessage(sender, ChatSettings.getUsingAloneMessageString());
}
private void applyFormats(AsyncPlayerChatEvent event, String originalFormat, String workingFormat, Resident resident) {
@@ -286,7 +286,7 @@ public class StandardChannel extends Channel {
// Remove spies who've already seen the message naturally.
spies.stream()
.filter(spy -> !recipients.contains(spy))
.forEach(spy -> spy.sendMessage(format + message));
.forEach(spy -> TownyMessaging.sendMessage(spy, format + message));
}
/**