change getConfig to be easier to use in external API

This commit is contained in:
jascotty2 2019-10-04 09:08:58 -05:00
parent d6847ec4f5
commit a5dd9b74a9
2 changed files with 7 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import java.util.logging.Level;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
/** /**
@ -44,11 +45,14 @@ public abstract class SongodaPlugin extends JavaPlugin {
public abstract List<Config> getExtraConfig(); public abstract List<Config> getExtraConfig();
@Override @Override
public ConfigFileConfigurationAdapter getConfig() { public FileConfiguration getConfig() {
// todo? change prototype to FileConfiguration? This seems to cause development issues due to shading.
return config.getFileConfig(); return config.getFileConfig();
} }
public Config getCoreConfig() {
return config;
}
@Override @Override
public void reloadConfig() { public void reloadConfig() {
config.load(); config.load();

View File

@ -36,7 +36,7 @@ public class PluginConfigGui extends SimplePagedGui {
this.plugin = plugin; this.plugin = plugin;
// collect list of plugins // collect list of plugins
configs.put(plugin.getConfig().getCoreConfig().getFile().getName(), plugin.getConfig().getCoreConfig()); configs.put(plugin.getCoreConfig().getFile().getName(), plugin.getCoreConfig());
List<Config> more = plugin.getExtraConfig(); List<Config> more = plugin.getExtraConfig();
if (more != null && !more.isEmpty()) { if (more != null && !more.isEmpty()) {
for (Config cfg : more) { for (Config cfg : more) {