Skip to content

Commit 2fff573

Browse files
committed
Further work
1 parent 244981a commit 2fff573

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

Core/src/main/java/com/plotsquared/core/generator/ClassicPlotWorld.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ public int getMinComponentHeight() {
164164
: getMinBuildHeight();
165165
}
166166

167+
/**
168+
* Get the lowest height of plot, road, and wall. Accounts for {@link Settings.Schematics#USE_WALL_IN_ROAD_SCHEM_HEIGHT}
169+
*/
167170
int schematicStartHeight() {
168171
int plotRoadMin = Math.min(PLOT_HEIGHT, ROAD_HEIGHT);
169172
if (!Settings.Schematics.USE_WALL_IN_ROAD_SCHEM_HEIGHT) {

Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ public void setupSchematics() throws SchematicHandler.UnsupportedFormatException
276276
SCHEM_Y = getMinGenHeight();
277277
plotY = 0;
278278
} else if (!Settings.Schematics.PASTE_ON_TOP) {
279+
// Schematics should generate/be pasted from build height
279280
SCHEM_Y = getMinBuildHeight();
280281
plotY = 0;
281282
}
@@ -293,18 +294,14 @@ public void setupSchematics() throws SchematicHandler.UnsupportedFormatException
293294
roadY = 0; // Road is the lowest schematic
294295
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != worldGenHeight) {
295296
// Road is the lowest schematic. Normalize plotY to it.
296-
if (Settings.Schematics.PASTE_ON_TOP) {
297-
plotY = PLOT_HEIGHT - getMinGenHeight();
298-
}
297+
plotY = (Settings.Schematics.PASTE_ON_TOP ? PLOT_HEIGHT : getMinBuildHeight()) - SCHEM_Y;
299298
}
300299
} else if (!Settings.Schematics.PASTE_ROAD_ON_TOP) {
301300
roadY = 0;
302301
SCHEM_Y = getMinGenHeight();
303-
if (schematic3 != null) {
304-
if (Settings.Schematics.PASTE_ON_TOP) {
305-
// Road is the lowest schematic. Normalize plotY to it.
306-
plotY = PLOT_HEIGHT - SCHEM_Y;
307-
}
302+
if (schematic3 != null && schematic3.getClipboard().getDimensions().getY() != worldGenHeight) {
303+
// Road is the lowest schematic. Normalize plotY to it.
304+
plotY = (Settings.Schematics.PASTE_ON_TOP ? PLOT_HEIGHT : getMinBuildHeight()) - SCHEM_Y;
308305
}
309306
} else {
310307
roadY = minRoadWall - SCHEM_Y;

Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
import java.util.Iterator;
6969
import java.util.LinkedHashSet;
7070
import java.util.List;
71+
import java.util.Objects;
7172
import java.util.Set;
7273
import java.util.concurrent.atomic.AtomicBoolean;
7374
import java.util.concurrent.atomic.AtomicInteger;
@@ -529,7 +530,7 @@ public boolean setupRoadSchematic(Plot plot) {
529530
final QueueCoordinator queue = blockQueue.getNewQueue(worldUtil.getWeWorld(world));
530531
Location bot = plot.getBottomAbs().subtract(1, 0, 1);
531532
Location top = plot.getTopAbs();
532-
final HybridPlotWorld plotworld = (HybridPlotWorld) plot.getArea();
533+
final HybridPlotWorld plotworld = Objects.requireNonNull((HybridPlotWorld) plot.getArea());
533534
// Do not use plotworld#schematicStartHeight() here as we want to restore the pre 6.1.4 way of doing it if
534535
// USE_WALL_IN_ROAD_SCHEM_HEIGHT is false
535536
int schemY = Settings.Schematics.USE_WALL_IN_ROAD_SCHEM_HEIGHT ?

0 commit comments

Comments
 (0)