Better UUID conversion

This commit is contained in:
boy0001 2015-05-01 17:52:32 +10:00
parent ea7926b0da
commit e792a85c00
2 changed files with 58 additions and 19 deletions

View File

@ -217,7 +217,7 @@ public class DebugUUID extends SubCommand {
MainUtil.sendConsoleMessage("&7 - Updating plot objects");
for (Plot plot : PlotSquared.getPlots()) {
for (Plot plot : PlotSquared.getPlotsRaw()) {
UUID value = uCMap.get(plot.owner);
if (value != null) {
plot.owner = value;

View File

@ -94,26 +94,21 @@ public class MainUtil {
myplot.settings.setMerged(new boolean[] { false, false, false, false });
DBFunc.setMerged(world, myplot, myplot.settings.getMerged());
}
if (plotworld.TYPE != 0 && plotworld.TERRAIN < 2) {
// FIXME unlink augmented
}
else {
for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) {
final boolean lx = x < pos2.x;
final boolean ly = y < pos2.y;
final Plot p = MainUtil.getPlot(world, new PlotId(x, y));
if (lx) {
manager.createRoadEast(plotworld, p);
if (ly) {
manager.createRoadSouthEast(plotworld, p);
}
}
for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) {
final boolean lx = x < pos2.x;
final boolean ly = y < pos2.y;
final Plot p = MainUtil.getPlot(world, new PlotId(x, y));
if (lx) {
manager.createRoadEast(plotworld, p);
if (ly) {
manager.createRoadSouth(plotworld, p);
manager.createRoadSouthEast(plotworld, p);
}
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
}
if (ly) {
manager.createRoadSouth(plotworld, p);
}
MainUtil.setSign(UUIDHandler.getName(plot.owner), plot);
}
}
manager.finishPlotUnlink(plotworld, ids);
@ -457,6 +452,50 @@ public class MainUtil {
return true;
}
public static void removeRoadSouthEast(PlotWorld plotworld, Plot plot) {
if (plotworld.TYPE != 0 && plotworld.TERRAIN > 1) {
PlotId id = plot.id;
PlotId id2 = new PlotId(id.x + 1, id.y + 1);
Location pos1 = getPlotTopLoc(plot.world, id).add(1, 0, 1);
Location pos2 = getPlotBottomLoc(plot.world, id2);
ChunkManager.manager.regenerateRegion(pos1, pos2, null);
}
else {
PlotSquared.getPlotManager(plot.world).removeRoadSouthEast(plotworld, plot);
}
}
public static void removeRoadEast(PlotWorld plotworld, Plot plot) {
if (plotworld.TYPE != 0 && plotworld.TERRAIN > 1) {
PlotId id = plot.id;
PlotId id2 = new PlotId(id.x + 1, id.y);
Location bot = getPlotBottomLocAbs(plot.world, id2);
Location top = getPlotTopLocAbs(plot.world, id);
Location pos1 = new Location(plot.world, top.getX() + 1, 0, bot.getZ() + 1);
Location pos2 = new Location(plot.world, bot.getX(), 0, top.getZ());
ChunkManager.manager.regenerateRegion(pos1, pos2, null);
}
else {
PlotSquared.getPlotManager(plot.world).removeRoadSouthEast(plotworld, plot);
}
}
public static void removeRoadSouth(PlotWorld plotworld, Plot plot) {
if (plotworld.TYPE != 0 && plotworld.TERRAIN > 1) {
PlotId id = plot.id;
PlotId id2 = new PlotId(id.x, id.y + 1);
Location bot = getPlotBottomLocAbs(plot.world, id2);
Location top = getPlotTopLocAbs(plot.world, id);
Location pos1 = new Location(plot.world, bot.getX() + 1, 0, top.getZ() + 1);
Location pos2 = new Location(plot.world, top.getX(), 0, bot.getZ());
ChunkManager.manager.regenerateRegion(pos1, pos2, null);
}
else {
PlotSquared.getPlotManager(plot.world).removeRoadSouthEast(plotworld, plot);
}
}
/**
* Merges 2 plots Removes the road inbetween <br> - Assumes the first plot parameter is lower <br> - Assumes neither
* are a Mega-plot <br> - Assumes plots are directly next to each other <br> - Saves to DB