Rewrite configuration system

This commit refactors almost all of the configuration section to make it more friendly for further development. In addition, files being saved without comments has been fixed.

 Emphasis has been put on retaining backwards compatibility, so most actual configuration options in flatfile have stayed the same. Minor changes are automatically upgraded.
This commit is contained in:
h31ix committed 2013-09-22 15:56:36 -04:00
1 parent 1e42d58926
commit 77ab0062b8
37 files changed
+1535 -1488

No files matched your search

@@ -0,0 +1,61 @@
/*
* AntiCheat for Bukkit.
* Copyright (C) 2012-2013 AntiCheat Team | http://gravitydevelopment.net
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.h31ix.anticheat.config.files;
import net.h31ix.anticheat.AntiCheat;
import net.h31ix.anticheat.config.Configuration;
import net.h31ix.anticheat.config.ConfigurationFile;
import java.util.List;
public class Lang extends ConfigurationFile {
public static final String FILENAME = "lang.yml";
public ConfigValue<List<String>> alert;
public ConfigValue<List<String>> playerWarning;
public ConfigValue<String> spamWarning;
public ConfigValue<String> spamKickReason;
public ConfigValue<String> spamBanReason;
public ConfigValue<String> spamKickBroadcast;
public ConfigValue<String> spamBanBroadcast;
public ConfigValue<String> banReason;
public ConfigValue<String> banBroadcast;
public ConfigValue<String> kickReason;
public ConfigValue<String> kickBroadcast;
public Lang(AntiCheat plugin, Configuration config) {
super(plugin, config, FILENAME);
}
@Override
public void open() {
alert = new ConfigValue<List<String>>("alert");
playerWarning = new ConfigValue<List<String>>("warning.player_warning");
spamWarning = new ConfigValue<String>("chat.warning");
spamKickReason = new ConfigValue<String>("chat.kick_reason");
spamBanReason = new ConfigValue<String>("chat.ban_reason");
spamKickBroadcast = new ConfigValue<String>("chat.kick_broadcast");
spamBanBroadcast = new ConfigValue<String>("chat.ban_broadcast");
banReason = new ConfigValue<String>("ban.ban_reason");
banBroadcast = new ConfigValue<String>("ban.ban_broadcast");
kickReason = new ConfigValue<String>("kick.kick_reason");
kickBroadcast = new ConfigValue<String>("kick.kick_broadcast");
}
}