mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Faster plot clearing for large plots. + sudo async.
- Optimized the plot clearing algorithm (biome + entity clearing) - Reduced immediate load by separating clearing into multiple tasks - Clearing 512x512 plot takes ~4.5 seconds
This commit is contained in:
parent
a028f4685b
commit
a424bb006f
@ -6,7 +6,7 @@
|
|||||||
<groupId>com.intellectualcrafters</groupId>
|
<groupId>com.intellectualcrafters</groupId>
|
||||||
|
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>2.3.3</version>
|
<version>2.3.4</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -48,7 +48,6 @@ public class Schematic extends SubCommand {
|
|||||||
|
|
||||||
public Schematic() {
|
public Schematic() {
|
||||||
super("schematic", "plots.schematic", "Schematic Command", "schematic {arg}", "sch", CommandCategory.ACTIONS, false);
|
super("schematic", "plots.schematic", "Schematic Command", "schematic {arg}", "sch", CommandCategory.ACTIONS, false);
|
||||||
|
|
||||||
// TODO command to fetch schematic from worldedit directory
|
// TODO command to fetch schematic from worldedit directory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Clearing
|
* Clearing
|
||||||
*/
|
*/
|
||||||
CLEARING_PLOT("&cClearing plot."),
|
CLEARING_PLOT("&cClearing plot async."),
|
||||||
CLEARING_DONE("&6Done, took &a%time%&6 ms!"),
|
CLEARING_DONE("&6Done, took &a%time%&6 ms!"),
|
||||||
CLEARING_DONE_PACKETS("&6(&a%time% &6ms for packets)"),
|
CLEARING_DONE_PACKETS("&6(&a%time% &6ms for packets)"),
|
||||||
/*
|
/*
|
||||||
|
@ -25,11 +25,13 @@ import com.intellectualcrafters.plot.PlotMain;
|
|||||||
import com.intellectualcrafters.plot.object.*;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -222,19 +224,8 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
return new Location(Bukkit.getWorld(plotworld.worldname), x, 256, z);
|
return new Location(Bukkit.getWorld(plotworld.worldname), x, 256, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void clearPlotAsync(final World world, final Plot plot) {
|
||||||
* Clearing the plot needs to only consider removing the blocks - This
|
PlotHelper.runners.put(plot, 1);
|
||||||
* implementation has used the SetCuboid function, as it is fast, and uses
|
|
||||||
* NMS code - It also makes use of the fact that deleting chunks is a lot
|
|
||||||
* faster than block updates This code is very messy, but you don't need to
|
|
||||||
* do something quite as complex unless you happen to have 512x512 sized
|
|
||||||
* plots
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean clearPlot(final World world, final Plot plot) {
|
|
||||||
|
|
||||||
// TODO LOAD CHUNKS TO CLEAR IT PROPERLY
|
|
||||||
|
|
||||||
final DefaultPlotWorld dpw = ((DefaultPlotWorld) PlotMain.getWorldSettings(world));
|
final DefaultPlotWorld dpw = ((DefaultPlotWorld) PlotMain.getWorldSettings(world));
|
||||||
|
|
||||||
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||||
@ -257,118 +248,268 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
if ((block.getTypeId() != wall.id) || (block.getData() != wall.data)) {
|
if ((block.getTypeId() != wall.id) || (block.getData() != wall.data)) {
|
||||||
setWall(world, dpw, plot.id, wall);
|
setWall(world, dpw, plot.id, wall);
|
||||||
}
|
}
|
||||||
|
int count = 10000;
|
||||||
|
|
||||||
|
int s_x = pos1.getBlockX();
|
||||||
|
int s_y = 0;
|
||||||
|
int s_z = pos1.getBlockZ();
|
||||||
|
|
||||||
|
int e_x = pos2.getBlockX();
|
||||||
|
int e_y = world.getMaxHeight();
|
||||||
|
int e_z = pos2.getBlockZ();
|
||||||
|
|
||||||
|
Plugin plugin = (Plugin) PlotMain.getMain();
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
}
|
||||||
|
}, 1L);
|
||||||
|
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, 1, pos2.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT, pos2.getBlockZ() + 1), filling);
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getBlockZ() + 1), plotfloor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clearing the plot needs to only consider removing the blocks - This
|
||||||
|
* implementation has used the SetCuboid function, as it is fast, and uses
|
||||||
|
* NMS code - It also makes use of the fact that deleting chunks is a lot
|
||||||
|
* faster than block updates This code is very messy, but you don't need to
|
||||||
|
* do something quite as complex unless you happen to have 512x512 sized
|
||||||
|
* plots
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean clearPlot(final World world, final Plot plot) {
|
||||||
|
PlotHelper.runners.put(plot, 1);
|
||||||
|
final Plugin plugin = (Plugin) PlotMain.getMain();
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.runners.remove(plot);
|
||||||
|
} }, 90L);
|
||||||
|
|
||||||
if ((pos2.getBlockX() - pos1.getBlockX()) < 48) {
|
final DefaultPlotWorld dpw = ((DefaultPlotWorld) PlotMain.getWorldSettings(world));
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, 1, pos2.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||||
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT, pos2.getBlockZ() + 1), filling);
|
final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
||||||
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getBlockZ() + 1), plotfloor);
|
|
||||||
return true;
|
final PlotBlock[] plotfloor = dpw.TOP_BLOCK;
|
||||||
|
final PlotBlock[] filling = dpw.MAIN_BLOCK;
|
||||||
|
|
||||||
|
// PlotBlock wall = dpw.WALL_BLOCK;
|
||||||
|
final PlotBlock wall = dpw.WALL_BLOCK;
|
||||||
|
|
||||||
|
final PlotBlock wall_filling = dpw.WALL_FILLING;
|
||||||
|
|
||||||
|
Block block = world.getBlockAt(new Location(world, pos1.getBlockX() - 1, 1, pos1.getBlockZ()));
|
||||||
|
if ((block.getTypeId() != wall_filling.id) || (block.getData() != wall_filling.data)) {
|
||||||
|
setWallFilling(world, dpw, plot.id, wall_filling);
|
||||||
}
|
}
|
||||||
final int startX = (pos1.getBlockX() / 16) * 16;
|
|
||||||
final int startZ = (pos1.getBlockZ() / 16) * 16;
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
final int chunkX = 16 + pos2.getBlockX();
|
|
||||||
final int chunkZ = 16 + pos2.getBlockZ();
|
Block block = world.getBlockAt(new Location(world, pos1.getBlockX() - 1, dpw.WALL_HEIGHT + 1, pos1.getBlockZ()));
|
||||||
final Location l1 = PlotHelper.getPlotBottomLoc(world, plot.id);
|
if ((block.getTypeId() != wall.id) || (block.getData() != wall.data)) {
|
||||||
final Location l2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
setWall(world, dpw, plot.id, wall);
|
||||||
final int plotMinX = l1.getBlockX() + 1;
|
}
|
||||||
final int plotMinZ = l1.getBlockZ() + 1;
|
|
||||||
final int plotMaxX = l2.getBlockX();
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
final int plotMaxZ = l2.getBlockZ();
|
if ((pos2.getBlockX() - pos1.getBlockX()) < 48) {
|
||||||
Location min = null;
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, 1, pos2.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
Location max = null;
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
for (int i = startX; i < chunkX; i += 16) {
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
for (int j = startZ; j < chunkZ; j += 16) {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
final Plot plot1 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j));
|
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT, pos2.getBlockZ() + 1), filling);
|
||||||
if ((plot1 != null) && (plot1.getId() != plot.getId())) {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
break;
|
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getBlockZ() + 1), plotfloor);
|
||||||
|
} }, 5L);
|
||||||
|
} }, 5L);
|
||||||
|
} }, 5L);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
final Plot plot2 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j));
|
|
||||||
if ((plot2 != null) && (plot2.getId() != plot.getId())) {
|
final int startX = (pos1.getBlockX() / 16) * 16;
|
||||||
break;
|
final int startZ = (pos1.getBlockZ() / 16) * 16;
|
||||||
}
|
final int chunkX = 16 + pos2.getBlockX();
|
||||||
final Plot plot3 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15));
|
final int chunkZ = 16 + pos2.getBlockZ();
|
||||||
if ((plot3 != null) && (plot3.getId() != plot.getId())) {
|
final Location l1 = PlotHelper.getPlotBottomLoc(world, plot.id);
|
||||||
break;
|
final Location l2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
||||||
}
|
final int plotMinX = l1.getBlockX() + 1;
|
||||||
final Plot plot4 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j + 15));
|
final int plotMinZ = l1.getBlockZ() + 1;
|
||||||
if ((plot4 != null) && (plot4.getId() != plot.getId())) {
|
final int plotMaxX = l2.getBlockX();
|
||||||
break;
|
final int plotMaxZ = l2.getBlockZ();
|
||||||
}
|
Location mn = null;
|
||||||
final Plot plot5 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15));
|
Location mx = null;
|
||||||
if ((plot5 != null) && (plot5.getId() != plot.getId())) {
|
for (int i = startX; i < chunkX; i += 16) {
|
||||||
break;
|
for (int j = startZ; j < chunkZ; j += 16) {
|
||||||
|
final Plot plot1 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j));
|
||||||
|
if ((plot1 != null) && (!plot1.getId().equals(plot.getId()))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
final Plot plot2 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j));
|
||||||
|
if ((plot2 != null) && (!plot2.getId().equals(plot.getId()))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
final Plot plot3 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15));
|
||||||
|
if ((plot3 != null) && (!plot3.getId().equals(plot.getId()))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
final Plot plot4 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j + 15));
|
||||||
|
if ((plot4 != null) && (!plot4.getId().equals(plot.getId()))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
final Plot plot5 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15));
|
||||||
|
if ((plot5 != null) && (!plot5.getId().equals(plot.getId()))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mn == null) {
|
||||||
|
mn = new Location(world, Math.max(i - 1, plotMinX), 0, Math.max(j - 1, plotMinZ));
|
||||||
|
mx = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
|
||||||
|
} else if ((mx.getBlockZ() < (j + 15)) || (mx.getBlockX() < (i + 15))) {
|
||||||
|
mx = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
|
||||||
|
}
|
||||||
|
world.regenerateChunk(i / 16, j / 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Location max = mx;
|
||||||
|
final Location min = mn;
|
||||||
|
|
||||||
if (min == null) {
|
if (min == null) {
|
||||||
min = new Location(world, Math.max(i - 1, plotMinX), 0, Math.max(j - 1, plotMinZ));
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, 1, pos2.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
max = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
} else if ((max.getBlockZ() < (j + 15)) || (max.getBlockX() < (i + 15))) {
|
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
max = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT, pos2.getBlockZ() + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getBlockZ() + 1), plotfloor);
|
||||||
|
} }, 5L);
|
||||||
|
} }, 5L);
|
||||||
|
} }, 5L);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (min.getBlockX() < plotMinX) {
|
||||||
|
min.setX(plotMinX);
|
||||||
|
}
|
||||||
|
if (min.getBlockZ() < plotMinZ) {
|
||||||
|
min.setZ(plotMinZ);
|
||||||
|
}
|
||||||
|
if (max.getBlockX() > plotMaxX) {
|
||||||
|
max.setX(plotMaxX);
|
||||||
|
}
|
||||||
|
if (max.getBlockZ() > plotMaxZ) {
|
||||||
|
max.setZ(plotMaxZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, 0, plotMinZ), new Location(world, min.getBlockX() + 1, 1, min.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, min.getBlockX() + 1, world.getMaxHeight() + 1, min.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, plotMinX, 1, plotMinZ), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT, plotMinZ), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 21L);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), 0, plotMinZ), new Location(world, max.getBlockX() + 1, 1, min.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, max.getBlockX() + 1, world.getMaxHeight() + 1, min.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), 1, plotMinZ), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT, min.getBlockZ() + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT, plotMinZ), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 25L);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), 0, plotMinZ), new Location(world, plotMaxX + 1, 1, min.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, min.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), 1, plotMinZ), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT, min.getBlockZ() + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT, plotMinZ), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 29L);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, 0, min.getBlockZ()), new Location(world, min.getBlockX() + 1, 1, max.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, min.getBlockZ()), new Location(world, min.getBlockX() + 1, world.getMaxHeight() + 1, max.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, plotMinX, 1, min.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT, max.getBlockZ() + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT, min.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, max.getBlockZ() + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 33L);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, 0, max.getBlockZ()), new Location(world, min.getBlockX() + 1, 1, plotMaxZ + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, max.getBlockZ()), new Location(world, min.getBlockX() + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, plotMinX, 1, max.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT, plotMaxZ + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT, max.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, plotMaxZ + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 37L);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), 0, max.getBlockZ()), new Location(world, max.getBlockX() + 1, 1, plotMaxZ + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT + 1, max.getBlockZ()), new Location(world, max.getBlockX() + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), 1, max.getBlockZ()), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT, plotMaxZ + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT, max.getBlockZ()), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, plotMaxZ + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 41L);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), 0, min.getBlockZ()), new Location(world, plotMaxX + 1, 1, max.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT + 1, min.getBlockZ()), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, max.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), 1, min.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT, max.getBlockZ() + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT, min.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT + 1, max.getBlockZ() + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 45L);
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), 0, max.getBlockZ()), new Location(world, plotMaxX + 1, 1, plotMaxZ + 1), new PlotBlock((short) 7, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT + 1, max.getBlockZ()), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0));
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), 1, max.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT, plotMaxZ + 1), filling);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT, max.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT + 1, plotMaxZ + 1), plotfloor);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 1L);
|
||||||
|
} }, 49L);
|
||||||
}
|
}
|
||||||
world.regenerateChunk(i / 16, j / 16);
|
} }, 20L);
|
||||||
}
|
} }, 20L);
|
||||||
}
|
|
||||||
|
|
||||||
if (min == null) {
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), 0, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, 1, pos2.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT + 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, world.getMaxHeight() + 1, pos2.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), 1, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT, pos2.getBlockZ() + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, pos1.getBlockX(), dpw.PLOT_HEIGHT, pos1.getBlockZ()), new Location(world, pos2.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getBlockZ() + 1), plotfloor);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (min.getBlockX() < plotMinX) {
|
|
||||||
min.setX(plotMinX);
|
|
||||||
}
|
|
||||||
if (min.getBlockZ() < plotMinZ) {
|
|
||||||
min.setZ(plotMinZ);
|
|
||||||
}
|
|
||||||
if (max.getBlockX() > plotMaxX) {
|
|
||||||
max.setX(plotMaxX);
|
|
||||||
}
|
|
||||||
if (max.getBlockZ() > plotMaxZ) {
|
|
||||||
max.setZ(plotMaxZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, 0, plotMinZ), new Location(world, min.getBlockX() + 1, 1, min.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, min.getBlockX() + 1, world.getMaxHeight() + 1, min.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, plotMinX, 1, plotMinZ), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT, plotMinZ), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), plotfloor);
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), 0, plotMinZ), new Location(world, max.getBlockX() + 1, 1, min.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, max.getBlockX() + 1, world.getMaxHeight() + 1, min.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), 1, plotMinZ), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT, min.getBlockZ() + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT, plotMinZ), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), plotfloor);
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), 0, plotMinZ), new Location(world, plotMaxX + 1, 1, min.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT + 1, plotMinZ), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, min.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), 1, plotMinZ), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT, min.getBlockZ() + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT, plotMinZ), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT + 1, min.getBlockZ() + 1), plotfloor);
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, 0, min.getBlockZ()), new Location(world, min.getBlockX() + 1, 1, max.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, min.getBlockZ()), new Location(world, min.getBlockX() + 1, world.getMaxHeight() + 1, max.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, plotMinX, 1, min.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT, max.getBlockZ() + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT, min.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, max.getBlockZ() + 1), plotfloor);
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, 0, max.getBlockZ()), new Location(world, min.getBlockX() + 1, 1, plotMaxZ + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT + 1, max.getBlockZ()), new Location(world, min.getBlockX() + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, plotMinX, 1, max.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT, plotMaxZ + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, plotMinX, dpw.PLOT_HEIGHT, max.getBlockZ()), new Location(world, min.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, plotMaxZ + 1), plotfloor);
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), 0, max.getBlockZ()), new Location(world, max.getBlockX() + 1, 1, plotMaxZ + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT + 1, max.getBlockZ()), new Location(world, max.getBlockX() + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), 1, max.getBlockZ()), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT, plotMaxZ + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, min.getBlockX(), dpw.PLOT_HEIGHT, max.getBlockZ()), new Location(world, max.getBlockX() + 1, dpw.PLOT_HEIGHT + 1, plotMaxZ + 1), plotfloor);
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), 0, min.getBlockZ()), new Location(world, plotMaxX + 1, 1, max.getBlockZ() + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT + 1, min.getBlockZ()), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, max.getBlockZ() + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), 1, min.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT, max.getBlockZ() + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT, min.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT + 1, max.getBlockZ() + 1), plotfloor);
|
|
||||||
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), 0, max.getBlockZ()), new Location(world, plotMaxX + 1, 1, plotMaxZ + 1), new PlotBlock((short) 7, (byte) 0));
|
|
||||||
PlotHelper.setSimpleCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT + 1, max.getBlockZ()), new Location(world, plotMaxX + 1, world.getMaxHeight() + 1, plotMaxZ + 1), new PlotBlock((short) 0, (byte) 0));
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), 1, max.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT, plotMaxZ + 1), filling);
|
|
||||||
PlotHelper.setCuboid(world, new Location(world, max.getBlockX(), dpw.PLOT_HEIGHT, max.getBlockZ()), new Location(world, plotMaxX + 1, dpw.PLOT_HEIGHT + 1, plotMaxZ + 1), plotfloor);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,15 +623,23 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
final int bottomZ = PlotHelper.getPlotBottomLoc(world, plot.id).getBlockZ() - 1;
|
final int bottomZ = PlotHelper.getPlotBottomLoc(world, plot.id).getBlockZ() - 1;
|
||||||
final int topZ = PlotHelper.getPlotTopLoc(world, plot.id).getBlockZ() + 1;
|
final int topZ = PlotHelper.getPlotTopLoc(world, plot.id).getBlockZ() + 1;
|
||||||
|
|
||||||
|
Block block = world.getBlockAt(PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 1, 1));
|
||||||
|
Biome current = block.getBiome();
|
||||||
|
if (biome.equals(current)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
for (int x = bottomX; x <= topX; x++) {
|
for (int x = bottomX; x <= topX; x++) {
|
||||||
for (int z = bottomZ; z <= topZ; z++) {
|
for (int z = bottomZ; z <= topZ; z++) {
|
||||||
world.getBlockAt(x, 0, z).setBiome(biome);
|
Block blk = world.getBlockAt(x, 0, z);
|
||||||
|
Biome c = blk.getBiome();
|
||||||
|
if (c.equals(biome)) {
|
||||||
|
x += 15;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
blk.setBiome(biome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotMain.updatePlot(plot);
|
|
||||||
PlotHelper.refreshPlotChunks(world, plot);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||||
import com.intellectualcrafters.plot.object.*;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -34,10 +36,13 @@ import org.bukkit.block.BlockState;
|
|||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -655,33 +660,27 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void clearAllEntities(final World world, final Plot plot, final boolean tile) {
|
public static void clearAllEntities(final World world, final Plot plot, final boolean tile) {
|
||||||
final Location pos1 = getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
|
||||||
final Location pos2 = getPlotTopLoc(world, plot.id);
|
List<Entity> entities = world.getEntities();
|
||||||
for (int i = (pos1.getBlockX() / 16) * 16; i < (16 + ((pos2.getBlockX() / 16) * 16)); i += 16) {
|
for (Entity entity : entities) {
|
||||||
for (int j = (pos1.getBlockZ() / 16) * 16; j < (16 + ((pos2.getBlockZ() / 16) * 16)); j += 16) {
|
PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
||||||
final Chunk chunk = world.getChunkAt(i, j);
|
if (plot.id.equals(id)) {
|
||||||
for (final Entity entity : chunk.getEntities()) {
|
if (entity instanceof Player) {
|
||||||
final PlotId id = PlayerFunctions.getPlot(entity.getLocation());
|
Player player = (Player) entity;
|
||||||
if ((id != null) && id.equals(plot.id)) {
|
PlotMain.teleportPlayer(player, entity.getLocation(), plot);
|
||||||
if (entity instanceof Player) {
|
PlotListener.plotExit(player, plot);
|
||||||
Player player = (Player) entity;
|
} else {
|
||||||
PlotMain.teleportPlayer(player, entity.getLocation(), plot);
|
entity.remove();
|
||||||
PlotListener.plotExit(player, plot);
|
|
||||||
} else {
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tile) {
|
|
||||||
for (final BlockState entity : chunk.getTileEntities()) {
|
|
||||||
entity.setRawData((byte) 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clear(final World world, final Plot plot) {
|
public static void clear(final World world, final Plot plot) {
|
||||||
|
if (runners.containsKey(plot)) {
|
||||||
|
PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
final PlotManager manager = PlotMain.getPlotManager(world);
|
final PlotManager manager = PlotMain.getPlotManager(world);
|
||||||
|
|
||||||
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
||||||
@ -692,12 +691,14 @@ public class PlotHelper {
|
|||||||
h = (prime * h) + pos1.getBlockZ();
|
h = (prime * h) + pos1.getBlockZ();
|
||||||
state = h;
|
state = h;
|
||||||
|
|
||||||
PlotHelper.setBiome(world, plot, Biome.FOREST);
|
|
||||||
|
|
||||||
manager.clearPlot(world, plot);
|
manager.clearPlot(world, plot);
|
||||||
|
|
||||||
if (canSetFast) {
|
if (canSetFast) {
|
||||||
refreshPlotChunks(world, plot);
|
final Plugin plugin = (Plugin) PlotMain.getMain();
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlotHelper.setBiome(world, plot, Biome.FOREST);
|
||||||
|
refreshPlotChunks(world, plot);
|
||||||
|
} }, 90L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -721,18 +722,18 @@ public class PlotHelper {
|
|||||||
|
|
||||||
PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT);
|
PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT);
|
||||||
|
|
||||||
final long start = System.nanoTime();
|
final long start = System.currentTimeMillis();
|
||||||
|
|
||||||
final World world;
|
final World world;
|
||||||
world = requester.getWorld();
|
world = requester.getWorld();
|
||||||
|
|
||||||
/*
|
|
||||||
* keep
|
|
||||||
*/
|
|
||||||
clearAllEntities(world, plot, false);
|
clearAllEntities(world, plot, false);
|
||||||
clear(world, plot);
|
clear(world, plot);
|
||||||
removeSign(world, plot);
|
removeSign(world, plot);
|
||||||
PlayerFunctions.sendMessage(requester, C.CLEARING_DONE.s().replaceAll("%time%", "" + ((System.nanoTime() - start) / 1000000.0)));
|
final Plugin plugin = (Plugin) PlotMain.getMain();
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
||||||
|
PlayerFunctions.sendMessage(requester, C.CLEARING_DONE.s().replaceAll("%time%", "" + ((System.currentTimeMillis() - start) / 1000.0)));
|
||||||
|
} }, 90L);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -801,19 +802,29 @@ public class PlotHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setBiome(final World world, final Plot plot, final Biome b) {
|
public static void setBiome(final World world, final Plot plot, final Biome b) {
|
||||||
final int bottomX = getPlotBottomLoc(world, plot.id).getBlockX() - 1;
|
final int bottomX = getPlotBottomLoc(world, plot.id).getBlockX();
|
||||||
final int topX = getPlotTopLoc(world, plot.id).getBlockX() + 1;
|
final int topX = getPlotTopLoc(world, plot.id).getBlockX() + 1;
|
||||||
final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ() - 1;
|
final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ();
|
||||||
final int topZ = getPlotTopLoc(world, plot.id).getBlockZ() + 1;
|
final int topZ = getPlotTopLoc(world, plot.id).getBlockZ() + 1;
|
||||||
|
|
||||||
|
Block block = world.getBlockAt(getPlotBottomLoc(world, plot.id).add(1, 1, 1));
|
||||||
|
Biome biome = block.getBiome();
|
||||||
|
|
||||||
|
if (biome.equals(b)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int x = bottomX; x <= topX; x++) {
|
for (int x = bottomX; x <= topX; x++) {
|
||||||
for (int z = bottomZ; z <= topZ; z++) {
|
for (int z = bottomZ; z <= topZ; z++) {
|
||||||
world.getBlockAt(x, 0, z).setBiome(b);
|
Block blk = world.getBlockAt(x, 0, z);
|
||||||
|
Biome c = blk.getBiome();
|
||||||
|
if (c.equals(b)) {
|
||||||
|
x += 15;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
blk.setBiome(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotMain.updatePlot(plot);
|
|
||||||
refreshPlotChunks(world, plot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getHeighestBlock(final World world, final int x, final int z) {
|
public static int getHeighestBlock(final World world, final int x, final int z) {
|
||||||
|
Loading…
Reference in New Issue
Block a user