Fix reloading issues

This commit is contained in:
dfsek
2020-12-09 01:36:21 -07:00
parent df3d3c6398
commit 47438b7db9
2 changed files with 13 additions and 5 deletions

View File

@@ -71,12 +71,17 @@ public class Terra extends GaeaPlugin {
private final ConfigRegistry registry = new ConfigRegistry();
private final PluginConfig config = new PluginConfig();
public void invalidate() {
public void reload() {
Map<World, TerraWorld> newMap = new HashMap<>();
worldMap.forEach((world, tw) -> {
String packID = tw.getConfig().getTemplate().getID();
newMap.put(world, new TerraWorld(world, registry.get(packID)));
});
worldMap.clear();
worlds.clear();
registry.clear();
worldMap.putAll(newMap);
}
@Override
public void onDisable() {
TerraChunkGenerator.saveAll();