No WorldConfig without ConfigurationSection; resolves #1052
This commit is contained in:
parent
81f520aabf
commit
2edf67b02c
|
@ -23,7 +23,6 @@ import de.erethon.dungeonsxl.world.WorldConfig;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
/**
|
||||
* Represents a dungeon script. See {@link de.erethon.dungeonsxl.dungeon.DDungeon}.
|
||||
|
@ -128,18 +127,8 @@ public class DungeonConfig extends DREConfig {
|
|||
floorCount = config.getInt("floorCount", floors.size() + 2);
|
||||
removeWhenPlayed = config.getBoolean("removeWhenPlayed", removeWhenPlayed);
|
||||
|
||||
ConfigurationSection overrideSection = config.getConfigurationSection("overrideValues");
|
||||
if (overrideSection != null) {
|
||||
overrideValues = new WorldConfig(plugin, overrideSection);
|
||||
} else {
|
||||
overrideValues = new WorldConfig(plugin);
|
||||
}
|
||||
ConfigurationSection defaultSection = config.getConfigurationSection("defaultValues");
|
||||
if (defaultValues != null) {
|
||||
defaultValues = new WorldConfig(plugin, defaultSection);
|
||||
} else {
|
||||
defaultValues = new WorldConfig(plugin);
|
||||
}
|
||||
overrideValues = new WorldConfig(plugin, config.getConfigurationSection("overrideValues"));
|
||||
defaultValues = new WorldConfig(plugin, config.getConfigurationSection("defaultValues"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -133,11 +133,7 @@ public class DResourceWorld implements ResourceWorld {
|
|||
|
||||
@Override
|
||||
public void addInvitedPlayer(OfflinePlayer player) {
|
||||
if (config == null) {
|
||||
config = new WorldConfig(plugin);
|
||||
}
|
||||
|
||||
config.addInvitedPlayer(player.getUniqueId().toString());
|
||||
getConfig(true).addInvitedPlayer(player.getUniqueId().toString());
|
||||
config.save();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,21 +47,18 @@ public class WorldConfig extends GameRuleContainer {
|
|||
private List<String> invitedPlayers = new ArrayList<>();
|
||||
private Environment worldEnvironment;
|
||||
|
||||
public WorldConfig(DungeonsXL plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public WorldConfig(DungeonsXL plugin, File file) {
|
||||
this(plugin);
|
||||
|
||||
this.plugin = plugin;
|
||||
this.file = file;
|
||||
config = YamlConfiguration.loadConfiguration(file);
|
||||
load();
|
||||
}
|
||||
|
||||
public WorldConfig(DungeonsXL plugin, ConfigurationSection config) {
|
||||
this(plugin);
|
||||
|
||||
this.plugin = plugin;
|
||||
if (config == null) {
|
||||
config = new YamlConfiguration();
|
||||
}
|
||||
this.config = config;
|
||||
load();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue