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

@ -88,9 +88,11 @@ import com.sk89q.worldedit.bukkit.WorldEditPlugin;
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
public static BukkitMain THIS;
public static WorldEditPlugin worldEdit;
private int[] version;
@Override
public int[] getServerVersion() {
if (version == null) {
@ -345,8 +347,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void registerWorldEditEvents() {
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
PS.get().worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
final String version = PS.get().worldEdit.getDescription().getVersion();
BukkitMain.worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
final String version = BukkitMain.worldEdit.getDescription().getVersion();
if ((version != null) && version.startsWith("5.")) {
log("&cThis version of WorldEdit does not support PlotSquared.");
log("&cPlease use WorldEdit 6+ for masking support");

View File

@ -42,6 +42,7 @@ public class AugmentedPopulator extends BlockPopulator {
public AugmentedPopulator(final String world, final BukkitPlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b) {
MainUtil.initCache();
PS.log("== NEW AUGMENTED POPULATOR FOR: " + world);
this.cluster = cluster;
this.generator = generator;
this.plotworld = PS.get().getPlotWorld(world);
@ -99,6 +100,7 @@ public class AugmentedPopulator extends BlockPopulator {
public void populate(final World world, final Random rand, final Chunk chunk) {
final int cx = chunk.getX();
final int cz = chunk.getZ();
PS.log("== POPULATING FOR: " + world + " | " + cx + "," + cz);
final int bx = cx << 4;
final int bz = cz << 4;
final int tx = bx + 15;
@ -257,8 +259,4 @@ public class AugmentedPopulator extends BlockPopulator {
populator.populate(world, this.r, chunk);
}
}
public boolean isIn(final RegionWrapper plot, final int x, final int z) {
return ((x >= plot.minX) && (x <= plot.maxX) && (z >= plot.minZ) && (z <= plot.maxZ));
}
}

View File

@ -139,6 +139,7 @@ import com.intellectualcrafters.plot.util.RegExUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.listeners.worldedit.WEManager;
import com.plotsquared.bukkit.object.BukkitLazyBlock;
import com.plotsquared.bukkit.object.BukkitPlayer;
@ -454,7 +455,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
final UUID uuid = pp.getUUID();
UUIDHandler.add(name, uuid);
ExpireManager.dates.put(uuid, System.currentTimeMillis());
if (PS.get().worldEdit != null) {
if (BukkitMain.worldEdit != null) {
if (Permissions.hasPermission(pp, PERMISSION_WORLDEDIT_BYPASS)) {
WEManager.bypass.add(pp.getName());
}
@ -741,7 +742,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("location");
BukkitUtil.getPlayer(event.getPlayer()).deleteMeta("lastplot");
if (PS.get().worldEdit != null) {
if (BukkitMain.worldEdit != null) {
if (!Permissions.hasPermission(pp, PERMISSION_WORLDEDIT_BYPASS)) {
WEManager.bypass.remove(pp.getName());
}
@ -1613,7 +1614,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
ExpireManager.dates.put(pp.getUUID(), System.currentTimeMillis());
EventUtil.unregisterPlayer(pp);
if (PS.get().worldEdit != null) {
if (BukkitMain.worldEdit != null) {
WEManager.bypass.remove(pp.getName());
}
if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) {

View File

@ -19,6 +19,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.bukkit.selections.Selection;
@ -93,7 +94,7 @@ public class WEListener implements Listener {
}
public boolean checkSelection(Player p, PlotPlayer pp, int modifier, long max, Cancellable e) {
final Selection selection = PS.get().worldEdit.getSelection(p);
final Selection selection = BukkitMain.worldEdit.getSelection(p);
if (selection == null) {
return true;
}

View File

@ -29,9 +29,6 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
public BukkitCommand() {
MainCommand.getInstance().addCommand(new DebugUUID());
if (Settings.ENABLE_CLUSTERS) {
MainCommand.getInstance().addCommand(new Cluster());
}
}
@Override

View File

@ -13,9 +13,11 @@ import org.bukkit.plugin.Plugin;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.generator.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.plotsquared.bukkit.generator.AugmentedPopulator;
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
@ -33,11 +35,7 @@ public class BukkitSetupUtils extends SetupUtils {
if (generator != null) {
PS.get().removePlotWorld(testWorld);
final String name = plugin.getDescription().getName();
// final PlotGenerator pgen = (PlotGenerator) generator;
// if (pgen.getPlotManager() instanceof SquarePlotManager) {
SetupUtils.generators.put(name, new BukkitGeneratorWrapper("CheckingPlotSquaredGenerator", generator));
// }
// }
}
}
}
@ -115,4 +113,9 @@ public class BukkitSetupUtils extends SetupUtils {
}
return null;
}
@Override
public void removePopulator(String world, PlotCluster cluster) {
AugmentedPopulator.removePopulator(world, cluster);
}
}

View File

@ -8,6 +8,7 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.bukkit.BukkitMain;
import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
@ -22,7 +23,7 @@ public class WorldEditSchematic {
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.getZ());
Vector pos2 = new Vector(top.getX(), top.getY(), top.getZ());
EditSession session = PS.get().worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
EditSession session = BukkitMain.worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
clipboard.copy(session);
try {
clipboard.saveSchematic(new File(file));