From 9710f43544173f15b1118b7da7b206c13eea817c Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Sun, 22 Aug 2021 15:14:50 -0500 Subject: [PATCH] - Fix default channels not being returned if TownyChat is searching for a channel of that type. - Closes https://github.com/TownyAdvanced/Towny/issues/4984 --- resources/changelog.txt | 4 +++- .../palmergames/bukkit/TownyChat/channels/ChannelsHolder.java | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/changelog.txt b/resources/changelog.txt index b5b613c..eb7dbce 100644 --- a/resources/changelog.txt +++ b/resources/changelog.txt @@ -379,4 +379,6 @@ v0.89: - Update min. Towny to 0.97.0.0 and remove NotRegisteredException catches. - Add support for EssentialsDiscord, courtesy of JRoy with PR #33. v0.90: - - Allow channeltags to make use of hex colour formatting. \ No newline at end of file + - Allow channeltags to make use of hex colour formatting. + - Fix default channels not being returned if TownyChat is searching for a channel of that type. + - Closes https://github.com/TownyAdvanced/Towny/issues/4984 \ No newline at end of file diff --git a/src/com/palmergames/bukkit/TownyChat/channels/ChannelsHolder.java b/src/com/palmergames/bukkit/TownyChat/channels/ChannelsHolder.java index 33c1490..fca246a 100644 --- a/src/com/palmergames/bukkit/TownyChat/channels/ChannelsHolder.java +++ b/src/com/palmergames/bukkit/TownyChat/channels/ChannelsHolder.java @@ -105,6 +105,10 @@ public class ChannelsHolder { String name = player.getName(); + // Return the defaultChan if it is the correct type, and the player is present in that channel. + if (getDefaultChannel() != null && getDefaultChannel().isPresent(name) && getDefaultChannel().getType().equals(type)) + return getDefaultChannel(); + for (Channel channel: channels.values()) { if (!channel.isPresent(name)) continue; if (!channel.getType().equals(type)) continue;