Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for channels.yml's with legacy channelTag keys. #59

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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