13
0

Fix 1.12 AutoPrüfer and more #143

Zusammengeführt
Chaoscaot hat 1 Commits von multiversion nach master 2023-02-08 22:41:15 +01:00 zusammengeführt
6 geänderte Dateien mit 109 neuen und 45 gelöschten Zeilen
Nur Änderungen aus Commit 6eccdbf3ec werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -81,7 +81,6 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
Material.GOLDEN_HORSE_ARMOR, Material.GOLDEN_HORSE_ARMOR,
Material.HONEY_BOTTLE); Material.HONEY_BOTTLE);
@Override
public AutoChecker.BlockScanResult scan(Clipboard clipboard) { public AutoChecker.BlockScanResult scan(Clipboard clipboard) {
AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult(); AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult();
BlockVector3 min = clipboard.getMinimumPoint(); BlockVector3 min = clipboard.getMinimumPoint();
@ -156,4 +155,31 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
} }
result.getDispenserItems().put(pos, counter); 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();
}
} }

Datei anzeigen

@ -1,7 +1,7 @@
/* /*
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 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 it under the terms of the GNU Affero General Public License as published by
@ -15,14 +15,18 @@
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package de.steamwar.schematicsystem.commands; package de.steamwar.schematicsystem.commands;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.CompoundTagBuilder; import com.sk89q.jnbt.CompoundTagBuilder;
import com.sk89q.jnbt.ListTag; 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.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.math.BlockVector3;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -135,4 +139,9 @@ public class SchematicCommand15 implements SchematicCommand.ISchematicCommand {
return clipboard; return clipboard;
} }
@Override
public void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException {
Operations.complete(new ForwardExtentCopy(editSession, clipboard.getRegion(), clipboard, clipboard.getMinimumPoint()));
}
} }

Datei anzeigen

@ -32,12 +32,7 @@ import java.util.stream.Collectors;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public class AutoChecker8 implements AutoChecker.IAutoChecker { 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 DISPENSER = Material.DISPENSER.getId();
private static final int AIR = Material.AIR.getId();
private static final int JUKEBOX = Material.JUKEBOX.getId(); private static final int JUKEBOX = Material.JUKEBOX.getId();
private static final int CHEST = Material.CHEST.getId(); private static final int CHEST = Material.CHEST.getId();
private static final Set<Integer> INVENTORY = new HashSet<>(); private static final Set<Integer> INVENTORY = new HashSet<>();
@ -147,9 +142,30 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
} }
@Override @Override
public AutoChecker.BlockScanResult scan(Clipboard clipboard) { public AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult(); AutoChecker.BlockScanResult blockScanResult = new AutoChecker.BlockScanResult();
scan(result, clipboard); scan(blockScanResult, clipboard);
return result; 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();
} }
} }

Datei anzeigen

@ -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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.schematicsystem.commands; 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.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.CheckSchemType;
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult; 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 { public Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception {
return null; return null;
} }
@Override
public void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException {
Operations.complete(new ForwardExtentCopy(editSession, clipboard.getRegion(), clipboard, clipboard.getMinimumPoint()));
}
} }

Datei anzeigen

@ -1,7 +1,7 @@
/* /*
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 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 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 class AutoChecker {
public static AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) { public static AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
BlockScanResult blockScanResult = impl.scan(clipboard); return impl.check(clipboard, type);
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();
} }
public static AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type) { public static AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type) {
return AutoCheckerResult.builder() return impl.sizeCheck(clipboard, type);
.type(type)
.height(clipboard.getDimensions().getBlockY())
.width(clipboard.getDimensions().getBlockX())
.depth(clipboard.getDimensions().getBlockZ())
.build();
} }
private static final IAutoChecker impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance()); private static final IAutoChecker impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());
public interface IAutoChecker { public interface IAutoChecker {
BlockScanResult scan(Clipboard clipboard); AutoCheckerResult check(Clipboard clipboard, CheckSchemType type);
AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type);
} }
@Getter @Getter

Datei anzeigen

@ -612,7 +612,7 @@ public class SchematicCommand extends SWCommand {
Clipboard clipboard = new BlockArrayClipboard(WorldEdit.getInstance().getSessionManager().findByName(player.getName()).getSelection(new BukkitWorld(player.getWorld()))); 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); 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); check(player, clipboard, type, "selection", false);
} catch (IncompleteRegionException e) { } catch (IncompleteRegionException e) {
@ -919,5 +919,6 @@ public class SchematicCommand extends SWCommand {
public static interface ISchematicCommand { public static interface ISchematicCommand {
Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception; Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception;
void createCopy(EditSession editSession, Clipboard clipboard) throws WorldEditException;
} }
} }