Skip to content

Commit 9ed0c7f

Browse files
authored
feat: allow gen schematics to be located under the paths.schematics location (#4742)
* feat: allow gen schematics to be located under the paths.schematics location - closes #4408 * Fix typo
1 parent 1f32909 commit 9ed0c7f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Core/src/main/java/com/plotsquared/core/configuration/Settings.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,11 @@ public static final class Paths {
435435

436436
public static String SCHEMATICS = "schematics";
437437
public static String TEMPLATES = "templates";
438+
@Comment({"If schematics used for generation should be searched for in the path.schematics location",
439+
" - This setting exists and is `false` by default for backwards compatibility.",
440+
" - If false then generation schematics must be located in `schematics`",
441+
" - Schematics must still always be under GEN_ROAD_SCHEMATIC/<world> etc."})
442+
public static boolean USE_SCHEMATICS_PATH_FOR_GEN_SCHEMATICS = false;
438443

439444
}
440445

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public static BaseBlock rotate(BaseBlock id) {
140140
@NonNull
141141
@Override
142142
protected PlotManager createManager() {
143-
return new HybridPlotManager(this, PlotSquared.platform().regionManager(),
143+
return new HybridPlotManager(
144+
this, PlotSquared.platform().regionManager(),
144145
PlotSquared.platform().injector().getInstance(ProgressSubscriberFactory.class)
145146
);
146147
}
@@ -215,15 +216,16 @@ public void setupSchematics() throws SchematicHandler.UnsupportedFormatException
215216

216217
// Try to determine root. This means that plot areas can have separate schematic
217218
// directories
219+
String schematicFolder = Settings.Paths.USE_SCHEMATICS_PATH_FOR_GEN_SCHEMATICS ? Settings.Paths.SCHEMATICS : "schematics";
218220
if (!(root =
219221
FileUtils.getFile(
220222
PlotSquared.platform().getDirectory(),
221-
"schematics/GEN_ROAD_SCHEMATIC/" + this.getWorldName() + "/" + this.getId()
223+
schematicFolder + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + this.getWorldName() + File.separator + this.getId()
222224
))
223225
.exists()) {
224226
root = FileUtils.getFile(
225227
PlotSquared.platform().getDirectory(),
226-
"schematics/GEN_ROAD_SCHEMATIC/" + this.getWorldName()
228+
schematicFolder + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + this.getWorldName()
227229
);
228230
}
229231

0 commit comments

Comments
 (0)