Skip to content

Commit

Permalink
Give channels.yml the abilities of the CommentedConfiguration. (#54)
Browse files Browse the repository at this point in the history
* Give channels.yml the abilities of the CommentedConfiguration

Now possible to update existing channels.yml files when the comments
should change.

Adds missing comments from the channels.yml, better explaining features
available to channels.

Deletes the old configuration handler that loaded yaml file details.

* Update channels comments and deprecate autojoin

* Fixes for legacy configs loading improperly.

* Add missing comments, update changelog.
  • Loading branch information
LlmDl authored Dec 27, 2023
1 parent 6540b2c commit 7f20d83
Show file tree
Hide file tree
Showing 6 changed files with 581 additions and 252 deletions.
5 changes: 4 additions & 1 deletion resources/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,7 @@ v0.110:
- The channels in the channels.yml may now be given listenpermission and speakpermission keys, whose values will be the permission node require to either speak or listen to the channel.
- When these are set on a channel they will make the permission key of the channel redundant and unused.
- Closes https://github.com/TownyAdvanced/Towny/issues/1020.
- Update min. Towny version to 0.100.0.0.
- Update min. Towny version to 0.100.0.0.
- Add CommentedConfiguration support to the channels.yml.
- The Comments in the file have been updated to include missing channel flags.
- It is now possible to update the file comments as new flags are added.
15 changes: 2 additions & 13 deletions src/com/palmergames/bukkit/TownyChat/Chat.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.palmergames.bukkit.TownyChat.channels.Channel;
import com.palmergames.bukkit.TownyChat.channels.ChannelsHolder;
import com.palmergames.bukkit.TownyChat.config.ChatSettings;
import com.palmergames.bukkit.TownyChat.config.ChannelConfigurationHandler;
import com.palmergames.bukkit.TownyChat.config.ChannelsSettings;
import com.palmergames.bukkit.TownyChat.listener.EssentialsDiscordHookListener;
import com.palmergames.bukkit.TownyChat.listener.TownyChatPlayerListener;
Expand Down Expand Up @@ -51,7 +50,6 @@ public class Chat extends JavaPlugin {

private TownyChatPlayerListener TownyPlayerListener;
private ChannelsHolder channels;
private ChannelConfigurationHandler channelsConfig;

protected PluginManager pm;
private static Chat chat = null;
Expand All @@ -75,7 +73,6 @@ public Chat() {
@Override
public void onEnable() {
pm = getServer().getPluginManager();
channelsConfig = new ChannelConfigurationHandler(this);
channels = new ChannelsHolder(this);
playerChannelMap = new ConcurrentHashMap<>();

Expand Down Expand Up @@ -121,7 +118,7 @@ private boolean townyVersionCheck() {
private void loadConfigs() {
FileMgmt.checkOrCreateFolders(new String[] { getRootPath(), getTownySettingsPath() });
chatConfigError = !ChatSettings.loadCommentedChatConfig();
channelsConfigError = !ChannelsSettings.loadCommentedChannelsConfig();//!channelsConfig.loadChannels();
channelsConfigError = !ChannelsSettings.loadCommentedChannelsConfig();
}

public static Chat getTownyChat() {
Expand All @@ -137,7 +134,6 @@ public void onDisable() {
towny = null;
pm = null;

channelsConfig = null;
channels = null;
playerChannelMap = null;
}
Expand Down Expand Up @@ -238,13 +234,6 @@ public ChannelsHolder getChannelsHandler() {
return channels;
}

/**
* @return the data
*/
public ChannelConfigurationHandler getConfigurationHandler() {
return channelsConfig;
}

public Towny getTowny() {
return towny;
}
Expand Down Expand Up @@ -286,7 +275,7 @@ private void registerObjectCommands() {
bukkitCommandMap.setAccessible(true);
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());

commandMap.registerAll("towny", commands);
commandMap.registerAll("TownyChat", commands);
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
Expand Down
10 changes: 10 additions & 0 deletions src/com/palmergames/bukkit/TownyChat/channels/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,20 @@ public boolean isHooked() {
return hooked;
}

/**
* deprecated since 0.110, this setting has been unused for an unknown amount of time.
* @param autojoin
*/
@Deprecated
public void setAutoJoin(boolean autojoin) {
this.autojoin = autojoin;
}

/**
* deprecated since 0.110, this setting has been unused for an unknown amount of time.
* @param autojoin
*/
@Deprecated
public boolean isAutoJoin() {
return autojoin;
}
Expand Down

This file was deleted.

Loading

0 comments on commit 7f20d83

Please sign in to comment.