diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java
index 6728a7f..257a077 100644
--- a/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java
+++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java
@@ -81,7 +81,6 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
Material.GOLDEN_HORSE_ARMOR,
Material.HONEY_BOTTLE);
- @Override
public AutoChecker.BlockScanResult scan(Clipboard clipboard) {
AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult();
BlockVector3 min = clipboard.getMinimumPoint();
@@ -156,4 +155,31 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
}
result.getDispenserItems().put(pos, counter);
}
+
+ @Override
+ public AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
+ AutoChecker.BlockScanResult blockScanResult = scan(clipboard);
+ return AutoCheckerResult.builder()
+ .type(type)
+ .height(clipboard.getDimensions().getBlockY())
+ .width(clipboard.getDimensions().getBlockX())
+ .depth(clipboard.getDimensions().getBlockZ())
+ .blockCounts(blockScanResult.getBlockCounts())
+ .defunctNbt(blockScanResult.getDefunctNbt())
+ .dispenserItems(blockScanResult.getDispenserItems())
+ .records(blockScanResult.getRecords())
+ .forbiddenItems(blockScanResult.getForbiddenItems())
+ .forbiddenNbt(blockScanResult.getForbiddenNbt())
+ .build();
+ }
+
+ @Override
+ public AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type) {
+ return AutoCheckerResult.builder()
+ .type(type)
+ .height(clipboard.getDimensions().getBlockY())
+ .width(clipboard.getDimensions().getBlockX())
+ .depth(clipboard.getDimensions().getBlockZ())
+ .build();
+ }
}
diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/SchematicCommand15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/SchematicCommand15.java
index 64797e0..5e437dc 100644
--- a/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/SchematicCommand15.java
+++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/commands/SchematicCommand15.java
@@ -1,28 +1,32 @@
/*
- This file is a part of the SteamWar software.
+ This file is a part of the SteamWar software.
- Copyright (C) 2022 SteamWar.de-Serverteam
+ Copyright (C) 2023 SteamWar.de-Serverteam
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-*/
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+ */
package de.steamwar.schematicsystem.commands;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.CompoundTagBuilder;
import com.sk89q.jnbt.ListTag;
+import com.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
+import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
+import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
@@ -135,4 +139,9 @@ public class SchematicCommand15 implements SchematicCommand.ISchematicCommand {
return clipboard;
}
+
+ @Override
+ public void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException {
+ Operations.complete(new ForwardExtentCopy(editSession, clipboard.getRegion(), clipboard, clipboard.getMinimumPoint()));
+ }
}
diff --git a/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java b/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java
index e983a73..adaff94 100644
--- a/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java
+++ b/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java
@@ -32,12 +32,7 @@ import java.util.stream.Collectors;
@SuppressWarnings("deprecation")
public class AutoChecker8 implements AutoChecker.IAutoChecker {
- private static final int TNT = Material.TNT.getId();
- private static final int SLIME = Material.SLIME_BLOCK.getId();
- private static final int OBSIDIAN = Material.OBSIDIAN.getId();
- private static final int BEDROCK = Material.BEDROCK.getId();
private static final int DISPENSER = Material.DISPENSER.getId();
- private static final int AIR = Material.AIR.getId();
private static final int JUKEBOX = Material.JUKEBOX.getId();
private static final int CHEST = Material.CHEST.getId();
private static final Set INVENTORY = new HashSet<>();
@@ -147,9 +142,30 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
}
@Override
- public AutoChecker.BlockScanResult scan(Clipboard clipboard) {
- AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult();
- scan(result, clipboard);
- return result;
+ public AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
+ AutoChecker.BlockScanResult blockScanResult = new AutoChecker.BlockScanResult();
+ scan(blockScanResult, clipboard);
+ return AutoCheckerResult.builder()
+ .type(type)
+ .height(clipboard.getDimensions().getBlockY())
+ .width(clipboard.getDimensions().getBlockX())
+ .depth(clipboard.getDimensions().getBlockZ())
+ .blockCounts(blockScanResult.getBlockCounts())
+ .defunctNbt(blockScanResult.getDefunctNbt())
+ .dispenserItems(blockScanResult.getDispenserItems())
+ .records(blockScanResult.getRecords())
+ .forbiddenItems(blockScanResult.getForbiddenItems())
+ .forbiddenNbt(blockScanResult.getForbiddenNbt())
+ .build();
+ }
+
+ @Override
+ public AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type) {
+ return AutoCheckerResult.builder()
+ .type(type)
+ .height(clipboard.getDimensions().getBlockY())
+ .width(clipboard.getDimensions().getBlockX())
+ .depth(clipboard.getDimensions().getBlockZ())
+ .build();
}
}
diff --git a/SchematicSystem_8/src/de/steamwar/schematicsystem/commands/SchematicCommand8.java b/SchematicSystem_8/src/de/steamwar/schematicsystem/commands/SchematicCommand8.java
index 28b5e3e..6a21204 100644
--- a/SchematicSystem_8/src/de/steamwar/schematicsystem/commands/SchematicCommand8.java
+++ b/SchematicSystem_8/src/de/steamwar/schematicsystem/commands/SchematicCommand8.java
@@ -1,6 +1,29 @@
+/*
+ This file is a part of the SteamWar software.
+
+ Copyright (C) 2023 SteamWar.de-Serverteam
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+ */
+
package de.steamwar.schematicsystem.commands;
+import com.sk89q.worldedit.EditSession;
+import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
+import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
+import com.sk89q.worldedit.function.operation.Operations;
import de.steamwar.schematicsystem.CheckSchemType;
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
@@ -10,4 +33,9 @@ public class SchematicCommand8 implements SchematicCommand.ISchematicCommand {
public Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception {
return null;
}
+
+ @Override
+ public void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException {
+ Operations.complete(new ForwardExtentCopy(editSession, clipboard.getRegion(), clipboard, clipboard.getMinimumPoint()));
+ }
}
diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoChecker.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoChecker.java
index 0c759e0..3645a2a 100644
--- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoChecker.java
+++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoChecker.java
@@ -1,7 +1,7 @@
/*
This file is a part of the SteamWar software.
- Copyright (C) 2022 SteamWar.de-Serverteam
+ Copyright (C) 2023 SteamWar.de-Serverteam
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -32,34 +32,18 @@ import java.util.*;
public class AutoChecker {
public static AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
- BlockScanResult blockScanResult = impl.scan(clipboard);
- return AutoCheckerResult.builder()
- .type(type)
- .height(clipboard.getDimensions().getBlockY())
- .width(clipboard.getDimensions().getBlockX())
- .depth(clipboard.getDimensions().getBlockZ())
- .blockCounts(blockScanResult.getBlockCounts())
- .defunctNbt(blockScanResult.getDefunctNbt())
- .dispenserItems(blockScanResult.getDispenserItems())
- .records(blockScanResult.getRecords())
- .forbiddenItems(blockScanResult.getForbiddenItems())
- .forbiddenNbt(blockScanResult.getForbiddenNbt())
- .build();
+ return impl.check(clipboard, type);
}
public static AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type) {
- return AutoCheckerResult.builder()
- .type(type)
- .height(clipboard.getDimensions().getBlockY())
- .width(clipboard.getDimensions().getBlockX())
- .depth(clipboard.getDimensions().getBlockZ())
- .build();
+ return impl.sizeCheck(clipboard, type);
}
private static final IAutoChecker impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());
public interface IAutoChecker {
- BlockScanResult scan(Clipboard clipboard);
+ AutoCheckerResult check(Clipboard clipboard, CheckSchemType type);
+ AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type);
}
@Getter
diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java
index a1bb8e4..1d752f2 100644
--- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java
+++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/commands/SchematicCommand.java
@@ -612,7 +612,7 @@ public class SchematicCommand extends SWCommand {
Clipboard clipboard = new BlockArrayClipboard(WorldEdit.getInstance().getSessionManager().findByName(player.getName()).getSelection(new BukkitWorld(player.getWorld())));
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(player.getWorld()), -1);
- Operations.complete(new ForwardExtentCopy(editSession, clipboard.getRegion(), clipboard, clipboard.getMinimumPoint()));
+ impl.createCopy(editSession, clipboard);
check(player, clipboard, type, "selection", false);
} catch (IncompleteRegionException e) {
@@ -919,5 +919,6 @@ public class SchematicCommand extends SWCommand {
public static interface ISchematicCommand {
Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception;
+ void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException;
}
}