mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Schematic centering
This commit is contained in:
parent
02de9c20a2
commit
a3df37100a
@ -928,7 +928,9 @@ public class PlotMain extends JavaPlugin implements Listener {
|
||||
}
|
||||
|
||||
public static void loadWorld(final String world, final ChunkGenerator generator) {
|
||||
System.out.print(2);
|
||||
if (getWorldSettings(world) != null) {
|
||||
System.out.print(3);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -940,6 +942,7 @@ public class PlotMain extends JavaPlugin implements Listener {
|
||||
final String path = "worlds." + world;
|
||||
|
||||
if (!LOADING_WORLD && (generator != null) && (generator instanceof PlotGenerator)) {
|
||||
System.out.print(4);
|
||||
plotGenerator = (PlotGenerator) generator;
|
||||
plotWorld = plotGenerator.getNewPlotWorld(world);
|
||||
plotManager = plotGenerator.getPlotManager();
|
||||
@ -963,7 +966,9 @@ public class PlotMain extends JavaPlugin implements Listener {
|
||||
addPlotWorld(world, plotWorld, plotManager);
|
||||
PlotHelper.setupBorder(world);
|
||||
} else {
|
||||
System.out.print(5 + " | " + (generator instanceof PlotGenerator));
|
||||
if (!worlds.contains(world)) {
|
||||
System.out.print(6);
|
||||
return;
|
||||
}
|
||||
if (!LOADING_WORLD) {
|
||||
|
@ -92,6 +92,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
PlotMain.sendConsoleSenderMessage("&c - road schematics are disabled for this world.");
|
||||
this.ROAD_SCHEMATIC_ENABLED = false;
|
||||
}
|
||||
System.out.print("LOADED!");
|
||||
}
|
||||
|
||||
public void setupSchematics() {
|
||||
@ -118,6 +119,17 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
short w3 = (short) d3.getX();
|
||||
short l3 = (short) d3.getZ();
|
||||
short h3 = (short) d3.getY();
|
||||
|
||||
int center_shift_x = 0;
|
||||
int center_shift_z = 0;
|
||||
if (l3 < PLOT_WIDTH) {
|
||||
center_shift_z = (int) ((PLOT_WIDTH - l3)/2);
|
||||
}
|
||||
if (w3 < PLOT_WIDTH) {
|
||||
center_shift_x = (int) ((PLOT_WIDTH - w3)/2);
|
||||
}
|
||||
|
||||
|
||||
for (short x = 0; x < w3; x++) {
|
||||
for (short z = 0; z < l3; z++) {
|
||||
for (short y = 0; y < h3; y++) {
|
||||
@ -125,7 +137,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
||||
short id = blocks3[index].getBlock();
|
||||
byte data = blocks3[index].getData();
|
||||
if (id != 0) {
|
||||
addOverlayBlock((short) (x + shift + oddshift), (short) (y), (short) (z + shift + oddshift), id, data, false);
|
||||
addOverlayBlock((short) (x + shift + oddshift + center_shift_x), (short) (y), (short) (z + shift + oddshift + center_shift_z), id, data, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user