13
0

Merge pull request 'Add Entities to AutoPrüfer' (#148) from entities into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #148
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Chaoscaot 2023-05-24 08:08:20 +02:00
Commit 5d4be80c61
4 geänderte Dateien mit 24 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.schematicsystem.autocheck; package de.steamwar.schematicsystem.autocheck;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
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;
@ -27,6 +28,7 @@ import de.steamwar.schematicsystem.CheckSchemType;
import org.bukkit.Material; import org.bukkit.Material;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
public class AutoChecker15 implements AutoChecker.IAutoChecker { public class AutoChecker15 implements AutoChecker.IAutoChecker {
private static final Set<Material> INVENTORY = EnumSet.of( private static final Set<Material> INVENTORY = EnumSet.of(
@ -170,6 +172,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
.records(blockScanResult.getRecords()) .records(blockScanResult.getRecords())
.forbiddenItems(blockScanResult.getForbiddenItems()) .forbiddenItems(blockScanResult.getForbiddenItems())
.forbiddenNbt(blockScanResult.getForbiddenNbt()) .forbiddenNbt(blockScanResult.getForbiddenNbt())
.entities(clipboard.getEntities().stream().map(Entity::getLocation).map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ())).collect(Collectors.toList()))
.build(); .build();
} }

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.schematicsystem.autocheck;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import de.steamwar.schematicsystem.CheckSchemType; import de.steamwar.schematicsystem.CheckSchemType;
@ -145,6 +146,7 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
public AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) { public AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
AutoChecker.BlockScanResult blockScanResult = new AutoChecker.BlockScanResult(); AutoChecker.BlockScanResult blockScanResult = new AutoChecker.BlockScanResult();
scan(blockScanResult, clipboard); scan(blockScanResult, clipboard);
return AutoCheckerResult.builder() return AutoCheckerResult.builder()
.type(type) .type(type)
.height(clipboard.getDimensions().getBlockY()) .height(clipboard.getDimensions().getBlockY())
@ -156,6 +158,7 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
.records(blockScanResult.getRecords()) .records(blockScanResult.getRecords())
.forbiddenItems(blockScanResult.getForbiddenItems()) .forbiddenItems(blockScanResult.getForbiddenItems())
.forbiddenNbt(blockScanResult.getForbiddenNbt()) .forbiddenNbt(blockScanResult.getForbiddenNbt())
.entities(clipboard.getEntities().stream().map(Entity::getLocation).map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ())).collect(Collectors.toList()))
.build(); .build();
} }

Datei anzeigen

@ -255,6 +255,7 @@ AUTO_CHECKER_RESULT_TOO_MANY_BLOCK=§7{0}: §c{1}§7, Max: §e{2}
AUTO_CHECKER_RESULT_FORBIDDEN_BLOCK=§7Forbidden block: §c{0} AUTO_CHECKER_RESULT_FORBIDDEN_BLOCK=§7Forbidden block: §c{0}
AUTO_CHECKER_RESULT_FORBIDDEN_ITEM=§7Forbidden Item: [{0}, {1}, {2}] -> §c{3} AUTO_CHECKER_RESULT_FORBIDDEN_ITEM=§7Forbidden Item: [{0}, {1}, {2}] -> §c{3}
AUTO_CHECKER_RESULT_DEFUNCT_NBT=§7Defunct NBT: §7[{0}, {1}, {2}] AUTO_CHECKER_RESULT_DEFUNCT_NBT=§7Defunct NBT: §7[{0}, {1}, {2}]
AUTO_CHECKER_RESULT_ENTITY=§7Entity: §7[{0}, {1}, {2}]
AUTO_CHECKER_RESULT_RECORD=§7Record: §c[{0}, {1}, {2}] AUTO_CHECKER_RESULT_RECORD=§7Record: §c[{0}, {1}, {2}]
AUTO_CHECKER_RESULT_TOO_MANY_DISPENSER_ITEMS=§7Dispenser: §c[{0}, {1}, {2}]§7, §c{3} §7items, Max: §e{4} AUTO_CHECKER_RESULT_TOO_MANY_DISPENSER_ITEMS=§7Dispenser: §c[{0}, {1}, {2}]§7, §c{3} §7items, Max: §e{4}
AUTO_CHECKER_RESULT_FORBIDDEN_ITEM_NBT=§7Forbidden Item NBT: [{0}, {1}, {2}] -> §c{3} AUTO_CHECKER_RESULT_FORBIDDEN_ITEM_NBT=§7Forbidden Item NBT: [{0}, {1}, {2}] -> §c{3}

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,7 +15,7 @@
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.autocheck; package de.steamwar.schematicsystem.autocheck;
@ -47,6 +47,7 @@ public class AutoCheckerResult {
private final List<BlockPos> records; private final List<BlockPos> records;
private final Map<BlockPos, Set<Material>> forbiddenItems; private final Map<BlockPos, Set<Material>> forbiddenItems;
private final Map<BlockPos, Set<Material>> forbiddenNbt; private final Map<BlockPos, Set<Material>> forbiddenNbt;
private final List<BlockPos> entities;
public boolean isOk() { public boolean isOk() {
return records.isEmpty() && return records.isEmpty() &&
@ -144,6 +145,9 @@ public class AutoCheckerResult {
defunctNbt.forEach(blockVector3 -> { defunctNbt.forEach(blockVector3 -> {
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_DEFUNCT_NBT", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockVector3), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ()); SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_DEFUNCT_NBT", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockVector3), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
}); });
entities.forEach(blockPos -> {
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_ENTITY", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockPos), blockPos.getX(), blockPos.getY(), blockPos.getZ());
});
if(type.isAfterDeadline()) { if(type.isAfterDeadline()) {
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_AFTER_DEADLINE", p, type.getDeadline()); SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_AFTER_DEADLINE", p, type.getDeadline());
} }