Merge pull request 'Fix 1.12 AutoPrüfer and more' (#143) from multiversion into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #143 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
5652832486
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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;
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
@ -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<Integer> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren