From 7b3be4ae1ef98d689bcd183af32bb0f284968cff Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 10 Apr 2021 19:57:56 +0200 Subject: [PATCH] Add CommandTestblock.genericTestblockCommand --- .../src/de/steamwar/bausystem/world/regions/Region_15.java | 6 ++++++ .../de/steamwar/bausystem/world/regions/PasteOptions.java | 5 +++++ .../de/steamwar/bausystem/commands/CommandTestblock.java | 5 ----- .../src/de/steamwar/bausystem/world/regions/Prototype.java | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java b/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java index 1c622f8..825e358 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/world/regions/Region_15.java @@ -19,6 +19,7 @@ package de.steamwar.bausystem.world.regions; +import com.google.common.collect.Sets; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; @@ -40,6 +41,8 @@ import org.bukkit.Bukkit; import java.io.File; import java.io.FileInputStream; import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; import java.util.Objects; class Region_15 { @@ -77,6 +80,9 @@ class Region_15 { e.setBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint())), BlockTypes.AIR.getDefaultState().toBaseBlock()); } Operations.completeBlindly(ch.createPaste(e).to(v).ignoreAirBlocks(pasteOptions.isIgnoreAir()).build()); + if (pasteOptions.isReset() && pasteOptions.getWaterLevel() != 0) { + e.replaceBlocks(new CuboidRegion(RegionUtils_15.toBlockVector3(pasteOptions.getMinPoint()), RegionUtils_15.toBlockVector3(pasteOptions.getMaxPoint()).withY(pasteOptions.getWaterLevel())), new HashSet<>(Arrays.asList(BlockTypes.AIR.getDefaultState().toBaseBlock())), BlockTypes.WATER.getDefaultState().toBaseBlock()); + } return e; } catch (WorldEditException e) { throw new SecurityException(e.getMessage(), e); diff --git a/BauSystem_API/src/de/steamwar/bausystem/world/regions/PasteOptions.java b/BauSystem_API/src/de/steamwar/bausystem/world/regions/PasteOptions.java index 52e58ff..2dfbea0 100644 --- a/BauSystem_API/src/de/steamwar/bausystem/world/regions/PasteOptions.java +++ b/BauSystem_API/src/de/steamwar/bausystem/world/regions/PasteOptions.java @@ -59,6 +59,11 @@ public class PasteOptions { */ private Point maxPoint = null; + /** + * Used in 1.15 + */ + private int waterLevel = 0; + public PasteOptions(boolean rotate) { this.rotate = rotate; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java index 5ee1967..902c054 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTestblock.java @@ -69,11 +69,6 @@ public class CommandTestblock extends SWCommand { schematicTestblockCommand(p, s, RegionExtensionType.NORMAL); } - @Register - public void schematicTestblockCommand(Player p, RegionExtensionType regionExtensionType, String s) { - schematicTestblockCommand(p, s, regionExtensionType); - } - @Register public void schematicTestblockCommand(Player p, String s, RegionExtensionType regionExtensionType) { if (!permissionCheck(p)) return; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java index 481e024..813fd1c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/world/regions/Prototype.java @@ -151,7 +151,7 @@ public class Prototype { public EditSession reset(Region region, Schematic schem, boolean ignoreAir, Color color, boolean reset) throws IOException, NoClipboardException { PasteOptions pasteOptions; if (reset) { - pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color, true, getMinPoint(region, RegionExtensionType.EXTENSION), getMaxPoint(region, RegionExtensionType.EXTENSION)); + pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color, true, getMinPoint(region, RegionExtensionType.EXTENSION), getMaxPoint(region, RegionExtensionType.EXTENSION), waterLevel); } else { pasteOptions = new PasteOptions(rotate ^ (schem != null && (schem.getSchemType().fightType() || schem.getSchemType().check())), ignoreAir, color); }