Skip to content

Commit

Permalink
- Add support for channels.yml's with legacy channelTag keys. (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
LlmDl authored Feb 19, 2024
1 parent e8166d4 commit ba695ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.palmergames.bukkit</groupId>
<artifactId>TownyChat</artifactId>
<packaging>jar</packaging>
<version>0.114</version>
<version>0.115</version>

<licenses>
<license>
Expand Down
4 changes: 3 additions & 1 deletion resources/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -488,4 +488,6 @@ v0.113:
- Fix channelTag not parsing properly.
- Closes https://github.com/TownyAdvanced/Towny/issues/7239.
v0.114:
- Actually fix {channelTag} not parsing properly.
- Actually fix {channelTag} not parsing properly.
v0.115:
- Add support for channels.yml's with legacy channelTag keys.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class ChannelsSettings {
private final static List<String> DEFAULT_CHANNELS = Arrays.asList("general","town","nation","alliance","admin","mod","local");

private static final String CHANNEL_TAG = "channeltag";
private static final String LEGACY_CHANNEL_TAG = "channelTag";
private static final String SPAM_TIME = "spam_time";
private static final String RANGE = "range";
private static final String DEFAULT = "default";
Expand Down Expand Up @@ -321,11 +322,12 @@ public String getType() {
}

public boolean hasChannelTag() {
return channelSettingsMap.containsKey(CHANNEL_TAG);
return channelSettingsMap.containsKey(CHANNEL_TAG) || channelSettingsMap.containsKey(LEGACY_CHANNEL_TAG);
}

public String getChannelTag() {
return (String) channelSettingsMap.getOrDefault(CHANNEL_TAG, "");
String slug = channelSettingsMap.containsKey(LEGACY_CHANNEL_TAG) ? LEGACY_CHANNEL_TAG : CHANNEL_TAG;
return (String) channelSettingsMap.getOrDefault(slug, "");
}

public boolean hasMessageColour() {
Expand Down

0 comments on commit ba695ae

Please sign in to comment.