mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 23:26:45 +01:00
Multiple fixe
This commit is contained in:
parent
33256e0ea4
commit
57e8563b31
@ -79,8 +79,6 @@ public class Move extends SubCommand {
|
||||
}
|
||||
Plot plot2 = MainUtil.getPlot(world2, plot2id);
|
||||
|
||||
System.out.print(plot1 + " | " + plot2);
|
||||
|
||||
if (plot1.equals(plot2)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot move <X;Z>");
|
||||
|
@ -111,7 +111,6 @@ public class HybridGen extends PlotGenerator {
|
||||
if (this.maxY == 0) {
|
||||
this.maxY = 256;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -190,14 +189,15 @@ public class HybridGen extends PlotGenerator {
|
||||
}
|
||||
return;
|
||||
}
|
||||
int sx = ((cx << 4) % this.size);
|
||||
int sz = ((cz << 4) % this.size);
|
||||
int sx = (short) ((this.X) % this.size);
|
||||
int sz = (short) ((this.Z) % this.size);
|
||||
if (sx < 0) {
|
||||
sx += this.size;
|
||||
}
|
||||
if (sz < 0) {
|
||||
sz += this.size;
|
||||
}
|
||||
|
||||
for (short x = 0; x < 16; x++) {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
if (biomes != null) {
|
||||
|
@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.generator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
@ -39,8 +40,6 @@ public class HybridPop extends PlotPopulator {
|
||||
final short pathWidthLower;
|
||||
final short pathWidthUpper;
|
||||
Biome biome;
|
||||
private int X;
|
||||
private int Z;
|
||||
private long state;
|
||||
private boolean doFilling = false;
|
||||
private boolean doFloor = false;
|
||||
@ -107,8 +106,6 @@ public class HybridPop extends PlotPopulator {
|
||||
|
||||
@Override
|
||||
public void populate(World world, RegionWrapper requiredRegion, PseudoRandom random, int cx, int cz) {
|
||||
this.X = cx << 4;
|
||||
this.Z = cz << 4;
|
||||
PlotSquared.getPlotManager(world.getName());
|
||||
if (requiredRegion != null) {
|
||||
short sx = (short) ((this.X) % this.size);
|
||||
@ -119,6 +116,7 @@ public class HybridPop extends PlotPopulator {
|
||||
if (sz < 0) {
|
||||
sz += this.size;
|
||||
}
|
||||
|
||||
for (short x = 0; x < 16; x++) {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
if (contains(requiredRegion, this.X + x, this.Z + z)) {
|
||||
@ -152,33 +150,29 @@ public class HybridPop extends PlotPopulator {
|
||||
}
|
||||
return;
|
||||
}
|
||||
short sx = (short) ((this.X) % this.size);
|
||||
short sz = (short) ((this.Z) % this.size);
|
||||
int sx = (short) ((this.X) % this.size);
|
||||
int sz = (short) ((this.Z) % this.size);
|
||||
if (sx < 0) {
|
||||
sx += this.size;
|
||||
}
|
||||
if (sz < 0) {
|
||||
sz += this.size;
|
||||
}
|
||||
// Setting biomes
|
||||
|
||||
for (short x = 0; x < 16; x++) {
|
||||
for (short z = 0; z < 16; z++) {
|
||||
final short absX = (short) ((sx + x) % this.size);
|
||||
final short absZ = (short) ((sz + z) % this.size);
|
||||
final int absX = ((sx + x) % this.size);
|
||||
final int absZ = ((sz + z) % this.size);
|
||||
final boolean gx = absX > this.pathWidthLower;
|
||||
final boolean gz = absZ > this.pathWidthLower;
|
||||
final boolean lx = absX < this.pathWidthUpper;
|
||||
final boolean lz = absZ < this.pathWidthUpper;
|
||||
// inside plot
|
||||
if (gx && gz && lx && lz) {
|
||||
if (this.doFilling) {
|
||||
for (short y = 1; y < this.plotheight; y++) {
|
||||
setBlock(x, y, z, this.filling);
|
||||
}
|
||||
}
|
||||
if (this.doFloor) {
|
||||
setBlock(x, (short) this.plotheight, z, this.plotfloors);
|
||||
for (short y = 1; y < this.plotheight; y++) {
|
||||
setBlock(x, y, z, this.filling);
|
||||
}
|
||||
setBlock(x, (short) this.plotheight, z, this.plotfloors);
|
||||
if (this.plotworld.PLOT_SCHEMATIC) {
|
||||
final PlotLoc loc = new PlotLoc(absX, absZ);
|
||||
final HashMap<Short, Byte> blocks = this.plotworld.G_SCH_DATA.get(loc);
|
||||
@ -201,21 +195,17 @@ public class HybridPop extends PlotPopulator {
|
||||
} else {
|
||||
// wall
|
||||
if (((absX >= this.pathWidthLower) && (absX <= this.pathWidthUpper) && (absZ >= this.pathWidthLower) && (absZ <= this.pathWidthUpper))) {
|
||||
if (this.wallfilling != 0) {
|
||||
for (short y = 1; y <= this.wallheight; y++) {
|
||||
setBlock(x, y, z, this.wallfilling);
|
||||
}
|
||||
for (short y = 1; y <= this.wallheight; y++) {
|
||||
setBlock(x, y, z, this.wallfilling);
|
||||
}
|
||||
if ((this.wall != 0) && !this.plotworld.ROAD_SCHEMATIC_ENABLED) {
|
||||
setBlock(x, (short) (this.wallheight + 1), z, this.wall);
|
||||
if (!this.plotworld.ROAD_SCHEMATIC_ENABLED) {
|
||||
setBlock(x, this.wallheight + 1, z, this.wall);
|
||||
}
|
||||
}
|
||||
// road
|
||||
else {
|
||||
if (this.roadblock != 0) {
|
||||
for (short y = 1; y <= this.roadheight; y++) {
|
||||
setBlock(x, y, z, this.roadblock);
|
||||
}
|
||||
for (short y = 1; y <= this.roadheight; y++) {
|
||||
setBlock(x, y, z, this.roadblock);
|
||||
}
|
||||
}
|
||||
if (this.plotworld.ROAD_SCHEMATIC_ENABLED) {
|
||||
|
@ -23,9 +23,6 @@ public class BukkitPlayer implements PlotPlayer {
|
||||
* @param player
|
||||
*/
|
||||
public BukkitPlayer(final Player player) {
|
||||
if (player == null) {
|
||||
System.out.print("=================== NULL PLAYER =========================");
|
||||
}
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@ import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
public abstract class PlotGenerator extends ChunkGenerator {
|
||||
|
||||
private short[][] result;
|
||||
private int X;
|
||||
private int Z;
|
||||
public int X;
|
||||
public int Z;
|
||||
private PseudoRandom random = new PseudoRandom();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -15,8 +15,8 @@ public abstract class PlotPopulator extends BlockPopulator {
|
||||
|
||||
private PseudoRandom random = new PseudoRandom();
|
||||
|
||||
private int X;
|
||||
private int Z;
|
||||
public int X;
|
||||
public int Z;
|
||||
private World world;
|
||||
|
||||
@Override
|
||||
|
@ -61,7 +61,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
|
||||
for (j = (pos1.getZ() / 16) * 16; j < (16 + ((pos2.getZ() / 16) * 16)); j += 16) {
|
||||
boolean result = ChunkManager.manager.loadChunk(world, new ChunkLoc(i, j));
|
||||
if (!result) {
|
||||
System.out.print("&cIllegal selection. Cannot save non-existent chunk at " + (i / 16) + ", " + (j / 16));
|
||||
PlotSquared.log("&cIllegal selection. Cannot save non-existent chunk at " + (i / 16) + ", " + (j / 16));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -859,7 +859,7 @@ public class MainUtil {
|
||||
|
||||
public static boolean move(final Plot plot1, final Plot plot2, final Runnable whenDone) {
|
||||
final com.intellectualcrafters.plot.object.Location bot1 = MainUtil.getPlotBottomLoc(plot1.world, plot1.id);
|
||||
final com.intellectualcrafters.plot.object.Location bot2 = MainUtil.getPlotBottomLoc(plot2.world, plot1.id);
|
||||
final com.intellectualcrafters.plot.object.Location bot2 = MainUtil.getPlotBottomLoc(plot2.world, plot2.id);
|
||||
final Location top = MainUtil.getPlotTopLoc(plot1.world, plot1.id);
|
||||
if (plot1.owner == null) {
|
||||
TaskManager.runTaskLater(whenDone, 1);
|
||||
@ -876,16 +876,15 @@ public class MainUtil {
|
||||
final int offset_y = plot2.id.y - pos1.id.y;
|
||||
final ArrayList<PlotId> selection = getPlotSelectionIds(pos1.id, pos2.id);
|
||||
for (final PlotId id : selection) {
|
||||
DBFunc.movePlot(getPlot(plot1.world, new PlotId(id.x, id.y)), getPlot(plot2.world, new PlotId(id.x + offset_x, id.y + offset_y)));
|
||||
String worldOriginal = plot1.world;
|
||||
PlotId idOriginal = new PlotId(id.x, id.y);
|
||||
final Plot plot = PlotSquared.getPlots(plot1.world).get(id);
|
||||
PlotSquared.getPlots(plot1.world).remove(id);
|
||||
plot.id.x += offset_x;
|
||||
plot.id.y += offset_y;
|
||||
PlotSquared.getPlots(plot2.world).put(plot.id, plot);
|
||||
DBFunc.movePlot(getPlot(worldOriginal, idOriginal), getPlot(plot2.world, new PlotId(id.x + offset_x, id.y + offset_y)));
|
||||
}
|
||||
System.out.print("BOT: " + bot1);
|
||||
System.out.print("TOP: " + top);
|
||||
System.out.print(" -> " + bot2);
|
||||
ChunkManager.manager.copyRegion(bot1, top, bot2, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -214,7 +214,6 @@ public abstract class SchematicHandler {
|
||||
}
|
||||
try {
|
||||
final File tmp = new File(path);
|
||||
System.out.print("ABS: " + tmp.getAbsolutePath());
|
||||
tmp.getParentFile().mkdirs();
|
||||
final OutputStream stream = new FileOutputStream(path);
|
||||
final NBTOutputStream output = new NBTOutputStream(new GZIPOutputStream(stream));
|
||||
|
@ -200,10 +200,8 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
final Chunk chunk = oldWorld.getChunkAt(x, z);
|
||||
chunks.add(chunk);
|
||||
chunk.load(false);
|
||||
saveEntitiesIn(chunk, region);
|
||||
}
|
||||
}
|
||||
restoreEntities(newWorld, relX, relZ);
|
||||
// Copy blocks
|
||||
final MutableInt mx = new MutableInt(sx);
|
||||
final Integer currentIndex = TaskManager.index.toInteger();
|
||||
@ -225,7 +223,16 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
mx.increment();
|
||||
if (xv == ex) { // done!
|
||||
for (int x = c1x; x <= c2x; x++) {
|
||||
for (int z = c1z; z <= c2z; z++) {
|
||||
final Chunk chunk = oldWorld.getChunkAt(x, z);
|
||||
chunks.add(chunk);
|
||||
chunk.load(false);
|
||||
saveEntitiesIn(chunk, region);
|
||||
}
|
||||
}
|
||||
restoreBlocks(newWorld, relX, relZ);
|
||||
restoreEntities(newWorld, relX, relZ);
|
||||
BukkitSetBlockManager.setBlockManager.update(chunks);
|
||||
for (final Chunk chunk : chunks) {
|
||||
chunk.unload(true, true);
|
||||
|
Loading…
Reference in New Issue
Block a user