mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fixed setup + new plot clearing
This commit is contained in:
parent
304decbcef
commit
5968b9e22e
@ -45,22 +45,24 @@ public class Setup extends SubCommand {
|
||||
}
|
||||
|
||||
public void displayGenerators(PlotPlayer plr) {
|
||||
MainUtil.sendMessage(plr, "&6What generator do you want?");
|
||||
StringBuffer message = new StringBuffer();
|
||||
message.append("&6What generator do you want?");
|
||||
for (Entry<String, ChunkGenerator> entry : SetupUtils.generators.entrySet()) {
|
||||
// + prefix + StringUtils.join(SetupUtils.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared")
|
||||
if (entry.getKey().equals("PlotSquared")) {
|
||||
MainUtil.sendMessage(plr, "\n&8 - &2" + entry.getKey() + "(Hybrid Generator)");
|
||||
message.append("\n&8 - &2" + entry.getKey() + "(Hybrid Generator)");
|
||||
}
|
||||
else if (entry.getValue() instanceof HybridGen) {
|
||||
MainUtil.sendMessage(plr, "\n&8 - &7" + entry.getKey() + "(Hybrid Generator)");
|
||||
message.append("\n&8 - &7" + entry.getKey() + "(Hybrid Generator)");
|
||||
}
|
||||
else if (entry.getValue() instanceof PlotGenerator) {
|
||||
MainUtil.sendMessage(plr, "\n&8 - &7" + entry.getKey() + "(Plot Generator)");
|
||||
message.append("\n&8 - &7" + entry.getKey() + "(Plot Generator)");
|
||||
}
|
||||
else {
|
||||
MainUtil.sendMessage(plr, "\n&8 - &7" + entry.getKey() + "(Unknown structure)");
|
||||
message.append("\n&8 - &7" + entry.getKey() + "(Unknown structure)");
|
||||
}
|
||||
}
|
||||
MainUtil.sendMessage(plr, message.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -601,7 +601,6 @@ public class MainUtil {
|
||||
*/
|
||||
public static boolean clearAsPlayer(final Plot plot, final boolean isDelete, final Runnable whenDone) {
|
||||
if (runners.containsKey(plot)) {
|
||||
System.out.print("RUNNABLE ALREADY");
|
||||
return false;
|
||||
}
|
||||
ChunkManager.manager.clearAllEntities(plot);
|
||||
@ -611,7 +610,6 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
public static void clear(final String world, final Plot plot, final boolean isDelete, final Runnable whenDone) {
|
||||
System.out.print(1);
|
||||
final PlotManager manager = PlotSquared.getPlotManager(world);
|
||||
final Location pos1 = MainUtil.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||
final int prime = 31;
|
||||
@ -622,24 +620,20 @@ public class MainUtil {
|
||||
System.currentTimeMillis();
|
||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||
runners.put(plot, 1);
|
||||
System.out.print(2);
|
||||
if (plotworld.TERRAIN != 0 || Settings.FAST_CLEAR) {
|
||||
final Location pos2 = MainUtil.getPlotTopLoc(world, plot.id);
|
||||
ChunkManager.manager.regenerateRegion(pos1, pos2, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.print(3);
|
||||
runners.remove(plot);
|
||||
TaskManager.runTask(whenDone);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
System.out.print(2.1);
|
||||
final Runnable run = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.print(3.1);
|
||||
MainUtil.setBiome(world, plot, "FOREST");
|
||||
runners.remove(plot);
|
||||
TaskManager.runTask(whenDone);
|
||||
@ -682,7 +676,7 @@ public class MainUtil {
|
||||
setSimpleCuboidAsync(world, pos1, pos2, blocks[0]);
|
||||
return;
|
||||
}
|
||||
for (int y = pos1.getY(); y < pos2.getY(); y++) {
|
||||
for (int y = pos1.getY(); y < Math.min(256, pos2.getY()); y++) {
|
||||
for (int x = pos1.getX(); x < pos2.getX(); x++) {
|
||||
for (int z = pos1.getZ(); z < pos2.getZ(); z++) {
|
||||
final int i = random.random(blocks.length);
|
||||
@ -717,7 +711,7 @@ public class MainUtil {
|
||||
}
|
||||
|
||||
public static void setSimpleCuboidAsync(final String world, final Location pos1, final Location pos2, final PlotBlock newblock) {
|
||||
for (int y = pos1.getY(); y < pos2.getY(); y++) {
|
||||
for (int y = pos1.getY(); y < Math.min(256, pos2.getY()); y++) {
|
||||
for (int x = pos1.getX(); x < pos2.getX(); x++) {
|
||||
for (int z = pos1.getZ(); z < pos2.getZ(); z++) {
|
||||
SetBlockQueue.setBlock(world, x, y, z, newblock);
|
||||
|
@ -278,9 +278,6 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
final int c1z = c1.getZ();
|
||||
final int c2x = c2.getX();
|
||||
final int c2z = c2.getZ();
|
||||
|
||||
System.out.print(4);
|
||||
|
||||
final ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
for (int x = c1x; x <= c2x; x++) {
|
||||
for (int z = c1z; z <= c2z; z++) {
|
||||
@ -297,13 +294,11 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
long start = System.currentTimeMillis();
|
||||
while (System.currentTimeMillis() - start < 20) {
|
||||
if (chunks.size() == 0) {
|
||||
System.out.print(5);
|
||||
TaskManager.runTaskLater(whenDone, 1);
|
||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
||||
TaskManager.tasks.remove(currentIndex);
|
||||
return;
|
||||
}
|
||||
System.out.print(6);
|
||||
CURRENT_PLOT_CLEAR = new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getZ(), pos2.getZ());
|
||||
final Chunk chunk = chunks.get(0);
|
||||
chunks.remove(0);
|
||||
|
Loading…
Reference in New Issue
Block a user