Config is handled by MainConfig not built in class

This commit is contained in:
ZeroEpoch1969 2018-06-29 12:15:36 -07:00
parent 92d63180f9
commit 107d886b35
No known key found for this signature in database
GPG Key ID: E0AAB104FB9F8FDF
2 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
@ -18,7 +19,8 @@ public class Command_links extends FreedomCommand
@Override @Override
protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) protected boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
ConfigurationSection section = plugin.getConfig().getConfigurationSection("social_links"); YamlConfiguration config = plugin.config.configuration;
ConfigurationSection section = config.getConfigurationSection("social_links");
if (section != null) if (section != null)
{ {
Map<String, Object> values = section.getValues(false); Map<String, Object> values = section.getValues(false);

View File

@ -21,6 +21,7 @@ public class MainConfig extends PluginComponent<TotalFreedomMod>
// //
private final EnumMap<ConfigEntry, Object> entries; private final EnumMap<ConfigEntry, Object> entries;
private final ConfigDefaults defaults; private final ConfigDefaults defaults;
public YamlConfiguration configuration;
public MainConfig(TotalFreedomMod plugin) public MainConfig(TotalFreedomMod plugin)
{ {
@ -67,6 +68,8 @@ public class MainConfig extends PluginComponent<TotalFreedomMod>
config.load(getConfigFile()); config.load(getConfigFile());
configuration = config;
for (ConfigEntry entry : ConfigEntry.values()) for (ConfigEntry entry : ConfigEntry.values())
{ {
String path = entry.getConfigName(); String path = entry.getConfigName();