Multiple fixe

This commit is contained in:
boy0001 2015-04-01 23:36:46 +11:00
parent 33256e0ea4
commit 57e8563b31
10 changed files with 37 additions and 47 deletions

View File

@ -79,8 +79,6 @@ public class Move extends SubCommand {
} }
Plot plot2 = MainUtil.getPlot(world2, plot2id); Plot plot2 = MainUtil.getPlot(world2, plot2id);
System.out.print(plot1 + " | " + plot2);
if (plot1.equals(plot2)) { if (plot1.equals(plot2)) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID); MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_ID);
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot move <X;Z>"); MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot move <X;Z>");

View File

@ -111,7 +111,6 @@ public class HybridGen extends PlotGenerator {
if (this.maxY == 0) { if (this.maxY == 0) {
this.maxY = 256; this.maxY = 256;
} }
} }
/** /**
@ -190,14 +189,15 @@ public class HybridGen extends PlotGenerator {
} }
return; return;
} }
int sx = ((cx << 4) % this.size); int sx = (short) ((this.X) % this.size);
int sz = ((cz << 4) % this.size); int sz = (short) ((this.Z) % this.size);
if (sx < 0) { if (sx < 0) {
sx += this.size; sx += this.size;
} }
if (sz < 0) { if (sz < 0) {
sz += this.size; sz += this.size;
} }
for (short x = 0; x < 16; x++) { for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
if (biomes != null) { if (biomes != null) {

View File

@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.generator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map.Entry;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
@ -39,8 +40,6 @@ public class HybridPop extends PlotPopulator {
final short pathWidthLower; final short pathWidthLower;
final short pathWidthUpper; final short pathWidthUpper;
Biome biome; Biome biome;
private int X;
private int Z;
private long state; private long state;
private boolean doFilling = false; private boolean doFilling = false;
private boolean doFloor = false; private boolean doFloor = false;
@ -107,8 +106,6 @@ public class HybridPop extends PlotPopulator {
@Override @Override
public void populate(World world, RegionWrapper requiredRegion, PseudoRandom random, int cx, int cz) { 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()); PlotSquared.getPlotManager(world.getName());
if (requiredRegion != null) { if (requiredRegion != null) {
short sx = (short) ((this.X) % this.size); short sx = (short) ((this.X) % this.size);
@ -119,6 +116,7 @@ public class HybridPop extends PlotPopulator {
if (sz < 0) { if (sz < 0) {
sz += this.size; sz += this.size;
} }
for (short x = 0; x < 16; x++) { for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
if (contains(requiredRegion, this.X + x, this.Z + z)) { if (contains(requiredRegion, this.X + x, this.Z + z)) {
@ -152,33 +150,29 @@ public class HybridPop extends PlotPopulator {
} }
return; return;
} }
short sx = (short) ((this.X) % this.size); int sx = (short) ((this.X) % this.size);
short sz = (short) ((this.Z) % this.size); int sz = (short) ((this.Z) % this.size);
if (sx < 0) { if (sx < 0) {
sx += this.size; sx += this.size;
} }
if (sz < 0) { if (sz < 0) {
sz += this.size; sz += this.size;
} }
// Setting biomes
for (short x = 0; x < 16; x++) { for (short x = 0; x < 16; x++) {
for (short z = 0; z < 16; z++) { for (short z = 0; z < 16; z++) {
final short absX = (short) ((sx + x) % this.size); final int absX = ((sx + x) % this.size);
final short absZ = (short) ((sz + z) % this.size); final int absZ = ((sz + z) % this.size);
final boolean gx = absX > this.pathWidthLower; final boolean gx = absX > this.pathWidthLower;
final boolean gz = absZ > this.pathWidthLower; final boolean gz = absZ > this.pathWidthLower;
final boolean lx = absX < this.pathWidthUpper; final boolean lx = absX < this.pathWidthUpper;
final boolean lz = absZ < this.pathWidthUpper; final boolean lz = absZ < this.pathWidthUpper;
// inside plot // inside plot
if (gx && gz && lx && lz) { if (gx && gz && lx && lz) {
if (this.doFilling) { for (short y = 1; y < this.plotheight; y++) {
for (short y = 1; y < this.plotheight; y++) { setBlock(x, y, z, this.filling);
setBlock(x, y, z, this.filling);
}
}
if (this.doFloor) {
setBlock(x, (short) this.plotheight, z, this.plotfloors);
} }
setBlock(x, (short) this.plotheight, z, this.plotfloors);
if (this.plotworld.PLOT_SCHEMATIC) { if (this.plotworld.PLOT_SCHEMATIC) {
final PlotLoc loc = new PlotLoc(absX, absZ); final PlotLoc loc = new PlotLoc(absX, absZ);
final HashMap<Short, Byte> blocks = this.plotworld.G_SCH_DATA.get(loc); final HashMap<Short, Byte> blocks = this.plotworld.G_SCH_DATA.get(loc);
@ -201,21 +195,17 @@ public class HybridPop extends PlotPopulator {
} else { } else {
// wall // wall
if (((absX >= this.pathWidthLower) && (absX <= this.pathWidthUpper) && (absZ >= this.pathWidthLower) && (absZ <= this.pathWidthUpper))) { 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++) {
for (short y = 1; y <= this.wallheight; y++) { setBlock(x, y, z, this.wallfilling);
setBlock(x, y, z, this.wallfilling);
}
} }
if ((this.wall != 0) && !this.plotworld.ROAD_SCHEMATIC_ENABLED) { if (!this.plotworld.ROAD_SCHEMATIC_ENABLED) {
setBlock(x, (short) (this.wallheight + 1), z, this.wall); setBlock(x, this.wallheight + 1, z, this.wall);
} }
} }
// road // road
else { else {
if (this.roadblock != 0) { for (short y = 1; y <= this.roadheight; y++) {
for (short y = 1; y <= this.roadheight; y++) { setBlock(x, y, z, this.roadblock);
setBlock(x, y, z, this.roadblock);
}
} }
} }
if (this.plotworld.ROAD_SCHEMATIC_ENABLED) { if (this.plotworld.ROAD_SCHEMATIC_ENABLED) {

View File

@ -23,9 +23,6 @@ public class BukkitPlayer implements PlotPlayer {
* @param player * @param player
*/ */
public BukkitPlayer(final Player player) { public BukkitPlayer(final Player player) {
if (player == null) {
System.out.print("=================== NULL PLAYER =========================");
}
this.player = player; this.player = player;
} }

View File

@ -36,8 +36,8 @@ import com.intellectualcrafters.plot.util.ChunkManager;
public abstract class PlotGenerator extends ChunkGenerator { public abstract class PlotGenerator extends ChunkGenerator {
private short[][] result; private short[][] result;
private int X; public int X;
private int Z; public int Z;
private PseudoRandom random = new PseudoRandom(); private PseudoRandom random = new PseudoRandom();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -15,8 +15,8 @@ public abstract class PlotPopulator extends BlockPopulator {
private PseudoRandom random = new PseudoRandom(); private PseudoRandom random = new PseudoRandom();
private int X; public int X;
private int Z; public int Z;
private World world; private World world;
@Override @Override

View File

@ -61,7 +61,7 @@ public class BukkitSchematicHandler extends SchematicHandler {
for (j = (pos1.getZ() / 16) * 16; j < (16 + ((pos2.getZ() / 16) * 16)); j += 16) { for (j = (pos1.getZ() / 16) * 16; j < (16 + ((pos2.getZ() / 16) * 16)); j += 16) {
boolean result = ChunkManager.manager.loadChunk(world, new ChunkLoc(i, j)); boolean result = ChunkManager.manager.loadChunk(world, new ChunkLoc(i, j));
if (!result) { 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; return null;
} }
} }

View File

@ -859,7 +859,7 @@ public class MainUtil {
public static boolean move(final Plot plot1, final Plot plot2, final Runnable whenDone) { 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 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); final Location top = MainUtil.getPlotTopLoc(plot1.world, plot1.id);
if (plot1.owner == null) { if (plot1.owner == null) {
TaskManager.runTaskLater(whenDone, 1); TaskManager.runTaskLater(whenDone, 1);
@ -876,16 +876,15 @@ public class MainUtil {
final int offset_y = plot2.id.y - pos1.id.y; final int offset_y = plot2.id.y - pos1.id.y;
final ArrayList<PlotId> selection = getPlotSelectionIds(pos1.id, pos2.id); final ArrayList<PlotId> selection = getPlotSelectionIds(pos1.id, pos2.id);
for (final PlotId id : selection) { 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); final Plot plot = PlotSquared.getPlots(plot1.world).get(id);
PlotSquared.getPlots(plot1.world).remove(id); PlotSquared.getPlots(plot1.world).remove(id);
plot.id.x += offset_x; plot.id.x += offset_x;
plot.id.y += offset_y; plot.id.y += offset_y;
PlotSquared.getPlots(plot2.world).put(plot.id, plot); 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() { ChunkManager.manager.copyRegion(bot1, top, bot2, new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -214,7 +214,6 @@ public abstract class SchematicHandler {
} }
try { try {
final File tmp = new File(path); final File tmp = new File(path);
System.out.print("ABS: " + tmp.getAbsolutePath());
tmp.getParentFile().mkdirs(); tmp.getParentFile().mkdirs();
final OutputStream stream = new FileOutputStream(path); final OutputStream stream = new FileOutputStream(path);
final NBTOutputStream output = new NBTOutputStream(new GZIPOutputStream(stream)); final NBTOutputStream output = new NBTOutputStream(new GZIPOutputStream(stream));

View File

@ -200,10 +200,8 @@ public class BukkitChunkManager extends ChunkManager {
final Chunk chunk = oldWorld.getChunkAt(x, z); final Chunk chunk = oldWorld.getChunkAt(x, z);
chunks.add(chunk); chunks.add(chunk);
chunk.load(false); chunk.load(false);
saveEntitiesIn(chunk, region);
} }
} }
restoreEntities(newWorld, relX, relZ);
// Copy blocks // Copy blocks
final MutableInt mx = new MutableInt(sx); final MutableInt mx = new MutableInt(sx);
final Integer currentIndex = TaskManager.index.toInteger(); final Integer currentIndex = TaskManager.index.toInteger();
@ -225,7 +223,16 @@ public class BukkitChunkManager extends ChunkManager {
} }
mx.increment(); mx.increment();
if (xv == ex) { // done! 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); restoreBlocks(newWorld, relX, relZ);
restoreEntities(newWorld, relX, relZ);
BukkitSetBlockManager.setBlockManager.update(chunks); BukkitSetBlockManager.setBlockManager.update(chunks);
for (final Chunk chunk : chunks) { for (final Chunk chunk : chunks) {
chunk.unload(true, true); chunk.unload(true, true);