Set the generators on loaded worlds

- uses reflection to access private fields of CBS internals
- sets the generator correctly (verified)
- sets the populators correctly (verified)
- should also work for augmented world types (needs verification)
This commit is contained in:
boy0001
2015-05-20 02:09:22 +10:00
parent bb4f8fceec
commit e7733e749d
4 changed files with 65 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package com.intellectualcrafters.plot;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.milkbowl.vault.economy.Economy;
@ -123,6 +124,7 @@ import com.intellectualcrafters.plot.util.bukkit.SendChunk;
import com.intellectualcrafters.plot.util.bukkit.SetBlockFast;
import com.intellectualcrafters.plot.util.bukkit.SetBlockFast_1_8;
import com.intellectualcrafters.plot.util.bukkit.SetBlockSlow;
import com.intellectualcrafters.plot.util.bukkit.SetGenCB;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper;
@ -172,7 +174,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
if (worlds.size() > 0) {
UUIDHandler.cacheAll(worlds.get(0).getName());
for (World world : worlds) {
Bukkit.getServer().unloadWorld(world, false);
try {
SetGenCB.setGenerator(world);
} catch (Exception e) {
log("Failed to reload world: " + world.getName());
Bukkit.getServer().unloadWorld(world, false);
}
}
}
}