Skip to content

Commit

Permalink
Merge pull request #50 from TownyAdvanced/fix/help_menu_colours
Browse files Browse the repository at this point in the history
Fix help menus not being coloured properly.
  • Loading branch information
LlmDl authored Jul 20, 2023
2 parents 6fa247f + 5a7e48a commit 6152de8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
14 changes: 7 additions & 7 deletions src/com/palmergames/bukkit/TownyChat/Command/ChannelCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
} else {
// Console
for (String line : channel_help) {
sender.sendMessage(Colors.strip(line));
TownyMessaging.sendMessage(sender, Colors.strip(line));
return true;
}
}
Expand All @@ -91,7 +91,7 @@ private void parseChannelCommand(Player player, String[] split) {
// 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")) {
Expand Down Expand Up @@ -130,7 +130,7 @@ public static void parseChannelList(Player player) {
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;
}
Expand Down Expand Up @@ -194,7 +194,7 @@ public static void parseChannelMuteList(Player player, String[] split) {
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;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public static void parseChannelMute(Player player, String[] split, boolean mute)
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;
}
Expand Down Expand Up @@ -341,7 +341,7 @@ public static void parseChannelLeave(Player player, String[] split) {
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;
}
Expand Down Expand Up @@ -390,7 +390,7 @@ public static void parseChannelJoin(Player player, String[] split) {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public boolean execute(CommandSender commandSender, String label, String[] args)
}
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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private boolean testDistance(Player player1, Player player2, double range) {
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) {
Expand Down Expand Up @@ -286,7 +286,7 @@ private void sendSpyMessage(AsyncPlayerChatEvent event, channelTypes type) {
// 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));
}

/**
Expand Down

0 comments on commit 6152de8

Please sign in to comment.