World generation options for sponge

This commit is contained in:
boy0001
2015-08-03 05:25:41 +10:00
parent b77c2d1049
commit 4d8b9f9674
23 changed files with 559 additions and 111 deletions

View File

@ -24,11 +24,10 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
import org.bukkit.generator.ChunkGenerator;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.generator.PlotGenerator;
import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@ -43,9 +42,10 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.generator.AugmentedPopulator;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.generator.HybridGen;
//import com.plotsquared.bukkit.generator.AugmentedPopulator;
//import com.plotsquared.bukkit.generator.AugmentedPopulator;
//import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
//import com.plotsquared.bukkit.generator.HybridGen;
import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(
@ -157,21 +157,32 @@ public class Cluster extends SubCommand {
PS.get().loadWorld(world, PS.get().IMP.getGenerator(world, null));
}
else {
final String gen_string = PS.get().config.getString("worlds." + world + "." + "generator.plugin");
BukkitPlotGenerator generator;
String gen_string = PS.get().config.getString("worlds." + world + "." + "generator.plugin");
if (gen_string == null) {
generator = new HybridGen(world);
} else {
ChunkGenerator chunkgen = (ChunkGenerator) PS.get().IMP.getGenerator(world, gen_string).generator;
if (chunkgen instanceof BukkitPlotGenerator) {
generator = (BukkitPlotGenerator) chunkgen;
}
else {
MainUtil.sendMessage(plr, C.SETUP_INVALID_GENERATOR, StringMan.join(SetupUtils.generators.keySet(), ","));
return false;
}
gen_string = "PlotSquared";
}
new AugmentedPopulator(world, generator, cluster, plotworld.TERRAIN == 2, plotworld.TERRAIN != 2);
PlotGenerator<?> wrapper = PS.get().IMP.getGenerator(world, gen_string);
if (wrapper.isFull()) {
wrapper.augment(cluster, plotworld);
}
else {
MainUtil.sendMessage(plr, C.SETUP_INVALID_GENERATOR, StringMan.join(SetupUtils.generators.keySet(), ","));
return false;
}
// BukkitPlotGenerator generator;
// if (gen_string == null) {
// generator = new HybridGen(world);
// } else {
// ChunkGenerator chunkgen = (ChunkGenerator) PS.get().IMP.getGenerator(world, gen_string).generator;
// if (chunkgen instanceof BukkitPlotGenerator) {
// generator = (BukkitPlotGenerator) chunkgen;
// }
// else {
// MainUtil.sendMessage(plr, C.SETUP_INVALID_GENERATOR, StringMan.join(SetupUtils.generators.keySet(), ","));
// return false;
// }
// }
// new AugmentedPopulator(world, generator, cluster, plotworld.TERRAIN == 2, plotworld.TERRAIN != 2);
}
MainUtil.sendMessage(plr, C.CLUSTER_ADDED);
return true;
@ -222,7 +233,7 @@ public class Cluster extends SubCommand {
}
DBFunc.delete(cluster);
if (plotworld.TYPE == 2) {
AugmentedPopulator.removePopulator(plr.getLocation().getWorld(), cluster);
SetupUtils.manager.removePopulator(plr.getLocation().getWorld(), cluster);
}
ClusterManager.last = null;
ClusterManager.clusters.get(cluster.world).remove(cluster);

View File

@ -125,6 +125,9 @@ public class MainCommand extends CommandManager<PlotPlayer> {
createCommand(new Copy());
createCommand(new Chat());
createCommand(new Trim());
if (Settings.ENABLE_CLUSTERS) {
MainCommand.getInstance().addCommand(new Cluster());
}
}
public static boolean no_permission(final PlotPlayer player, final String permission) {

View File

@ -25,6 +25,7 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.listeners.worldedit.WEManager;
import com.plotsquared.general.commands.CommandDeclaration;
@ -41,7 +42,7 @@ public class WE_Anywhere extends SubCommand {
@Override
public boolean onCommand(PlotPlayer player, String[] arguments) {
if (PS.get().worldEdit == null) {
if (BukkitMain.worldEdit == null) {
MainUtil.sendMessage(player, "&cWorldEdit is not enabled on this server");
return true;
}