Fix world configs not using lowercase name on reload.

This commit is contained in:
bloodshot 2020-11-08 22:35:26 -05:00
parent 2121e09e91
commit 6a2ebf2e5b
2 changed files with 15 additions and 15 deletions

View File

@ -1080,19 +1080,19 @@ public void loadConfig() {
if (this.dataStore != null) {
for (World world : Bukkit.getServer().getWorlds()) {
final String dimType = world.getEnvironment().name().toLowerCase();
final String worldName = world.getName().toLowerCase();
final Path dimPath = rootConfigPath.resolve(dimType);
if (Files.notExists(dimPath.resolve(world.getName()))) {
if (Files.notExists(dimPath.resolve(worldName))) {
try {
Files.createDirectories(rootConfigPath.resolve(dimType).resolve(world.getName()));
Files.createDirectories(rootConfigPath.resolve(dimType).resolve(worldName));
} catch (IOException e) {
e.printStackTrace();
}
}
GriefDefenderConfig<ConfigBase> dimConfig = new GriefDefenderConfig<>(ConfigBase.class, dimPath.resolve("dimension.conf"), BaseStorage.globalConfig);
GriefDefenderConfig<ConfigBase> worldConfig = new GriefDefenderConfig<>(ConfigBase.class, dimPath.resolve(world.getName()).resolve("world.conf"), dimConfig);
BaseStorage.dimensionConfigMap.put(world.getUID(), dimConfig);
GriefDefenderConfig<ConfigBase> worldConfig = new GriefDefenderConfig<>(ConfigBase.class, dimPath.resolve(worldName).resolve("world.conf"), dimConfig);
BaseStorage.worldConfigMap.put(world.getUID(), worldConfig);
// refresh player data
@ -1109,7 +1109,7 @@ public void loadConfig() {
GriefDefenderPlugin.getGlobalConfig().save();
}
if (this.worldEditProvider != null) {
this.getLogger().info("Loading schematics for world " + world.getName() + "...");
this.getLogger().info("Loading schematics for world " + worldName + "...");
this.worldEditProvider.loadSchematics(world);
}
}

View File

@ -1145,20 +1145,20 @@ public void loadConfig() {
for (World world : Sponge.getGame().getServer().getWorlds()) {
DimensionType dimType = world.getProperties().getDimensionType();
final String[] parts = dimType.getId().split(":");
final String worldName = world.getProperties().getWorldName();
final Path dimPath = rootConfigPath.resolve(parts[0]).resolve(dimType.getName());
if (!Files.exists(dimPath.resolve(world.getProperties().getWorldName()))) {
if (!Files.exists(dimPath.resolve(worldName))) {
try {
Files.createDirectories(rootConfigPath.resolve(dimType.getId()).resolve(world.getName()));
Files.createDirectories(rootConfigPath.resolve(dimType.getId()).resolve(worldName));
} catch (IOException e) {
e.printStackTrace();
}
}
GriefDefenderConfig<ConfigBase> dimConfig = new GriefDefenderConfig<>(ConfigBase.class, dimPath.resolve("dimension.conf"), BaseStorage.globalConfig);
GriefDefenderConfig<ConfigBase> worldConfig = new GriefDefenderConfig<>(ConfigBase.class, dimPath.resolve(world.getProperties().getWorldName()).resolve("world.conf"), dimConfig);
BaseStorage.dimensionConfigMap.put(world.getProperties().getUniqueId(), dimConfig);
BaseStorage.worldConfigMap.put(world.getProperties().getUniqueId(), worldConfig);
BaseStorage.dimensionConfigMap.put(world.getUniqueId(), dimConfig);
GriefDefenderConfig<ConfigBase> worldConfig = new GriefDefenderConfig<>(ConfigBase.class, dimPath.resolve(worldName).resolve("world.conf"), dimConfig);
BaseStorage.worldConfigMap.put(world.getUniqueId(), worldConfig);
// refresh player data
final GDClaimManager claimManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(world.getUniqueId());
@ -1174,10 +1174,10 @@ public void loadConfig() {
GriefDefenderPlugin.getGlobalConfig().save();
}
if (this.worldEditProvider != null && GriefDefenderPlugin.getGlobalConfig().getConfig().claim.useWorldEditSchematics) {
this.getLogger().info("Loading schematics for world " + world.getName() + "...");
this.getLogger().info("Loading schematics for world " + worldName + "...");
this.worldEditProvider.loadSchematics(world);
} else {
this.getLogger().info("Loading sponge schematics for world " + world.getName() + "...");
this.getLogger().info("Loading sponge schematics for world " + worldName + "...");
((FileStorage) this.dataStore).loadSpongeSchematics(world);
}
}