|
|
|
@ -25,11 +25,13 @@ import com.intellectualcrafters.plot.PlotMain;
|
|
|
|
|
import com.intellectualcrafters.plot.object.*;
|
|
|
|
|
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
|
|
|
|
import com.intellectualcrafters.plot.util.PlotHelper;
|
|
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
|
import org.bukkit.World;
|
|
|
|
|
import org.bukkit.block.Biome;
|
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
@ -222,19 +224,8 @@ public class DefaultPlotManager extends PlotManager {
|
|
|
|
|
return new Location(Bukkit.getWorld(plotworld.worldname), x, 256, z);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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) {
|
|
|
|
|
|
|
|
|
|
// TODO LOAD CHUNKS TO CLEAR IT PROPERLY
|
|
|
|
|
|
|
|
|
|
public void clearPlotAsync(final World world, final Plot plot) {
|
|
|
|
|
PlotHelper.runners.put(plot, 1);
|
|
|
|
|
final DefaultPlotWorld dpw = ((DefaultPlotWorld) PlotMain.getWorldSettings(world));
|
|
|
|
|
|
|
|
|
|
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)) {
|
|
|
|
|
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) {
|
|
|
|
|
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);
|
|
|
|
|
return true;
|
|
|
|
|
final DefaultPlotWorld dpw = ((DefaultPlotWorld) PlotMain.getWorldSettings(world));
|
|
|
|
|
|
|
|
|
|
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
|
|
|
|
|
final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
final int chunkX = 16 + pos2.getBlockX();
|
|
|
|
|
final int chunkZ = 16 + pos2.getBlockZ();
|
|
|
|
|
final Location l1 = PlotHelper.getPlotBottomLoc(world, plot.id);
|
|
|
|
|
final Location l2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
|
|
|
|
final int plotMinX = l1.getBlockX() + 1;
|
|
|
|
|
final int plotMinZ = l1.getBlockZ() + 1;
|
|
|
|
|
final int plotMaxX = l2.getBlockX();
|
|
|
|
|
final int plotMaxZ = l2.getBlockZ();
|
|
|
|
|
Location min = null;
|
|
|
|
|
Location max = null;
|
|
|
|
|
for (int i = startX; i < chunkX; i += 16) {
|
|
|
|
|
for (int j = startZ; j < chunkZ; j += 16) {
|
|
|
|
|
final Plot plot1 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j));
|
|
|
|
|
if ((plot1 != null) && (plot1.getId() != plot.getId())) {
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
|
|
|
|
|
|
|
|
|
Block block = world.getBlockAt(new Location(world, pos1.getBlockX() - 1, dpw.WALL_HEIGHT + 1, pos1.getBlockZ()));
|
|
|
|
|
if ((block.getTypeId() != wall.id) || (block.getData() != wall.data)) {
|
|
|
|
|
setWall(world, dpw, plot.id, wall);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
|
|
|
|
if ((pos2.getBlockX() - pos1.getBlockX()) < 48) {
|
|
|
|
|
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));
|
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
|
|
|
|
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));
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
final Plot plot2 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j));
|
|
|
|
|
if ((plot2 != null) && (plot2.getId() != plot.getId())) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
final Plot plot3 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15));
|
|
|
|
|
if ((plot3 != null) && (plot3.getId() != plot.getId())) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
final Plot plot4 = PlotHelper.getCurrentPlot(new Location(world, i, 0, j + 15));
|
|
|
|
|
if ((plot4 != null) && (plot4.getId() != plot.getId())) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
final Plot plot5 = PlotHelper.getCurrentPlot(new Location(world, i + 15, 0, j + 15));
|
|
|
|
|
if ((plot5 != null) && (plot5.getId() != plot.getId())) {
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
final int startX = (pos1.getBlockX() / 16) * 16;
|
|
|
|
|
final int startZ = (pos1.getBlockZ() / 16) * 16;
|
|
|
|
|
final int chunkX = 16 + pos2.getBlockX();
|
|
|
|
|
final int chunkZ = 16 + pos2.getBlockZ();
|
|
|
|
|
final Location l1 = PlotHelper.getPlotBottomLoc(world, plot.id);
|
|
|
|
|
final Location l2 = PlotHelper.getPlotTopLoc(world, plot.id);
|
|
|
|
|
final int plotMinX = l1.getBlockX() + 1;
|
|
|
|
|
final int plotMinZ = l1.getBlockZ() + 1;
|
|
|
|
|
final int plotMaxX = l2.getBlockX();
|
|
|
|
|
final int plotMaxZ = l2.getBlockZ();
|
|
|
|
|
Location mn = null;
|
|
|
|
|
Location mx = null;
|
|
|
|
|
for (int i = startX; i < chunkX; i += 16) {
|
|
|
|
|
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) {
|
|
|
|
|
min = new Location(world, Math.max(i - 1, plotMinX), 0, Math.max(j - 1, plotMinZ));
|
|
|
|
|
max = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
|
|
|
|
|
} else if ((max.getBlockZ() < (j + 15)) || (max.getBlockX() < (i + 15))) {
|
|
|
|
|
max = new Location(world, Math.min(i + 16, plotMaxX), 0, Math.min(j + 16, plotMaxZ));
|
|
|
|
|
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));
|
|
|
|
|
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() {
|
|
|
|
|
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));
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
} }, 20L);
|
|
|
|
|
} }, 20L);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -482,15 +623,23 @@ public class DefaultPlotManager extends PlotManager {
|
|
|
|
|
final int bottomZ = PlotHelper.getPlotBottomLoc(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 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|