13
0

Add Entities to AutoPrüfer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Chaoscaot 2023-05-13 17:58:07 +02:00
Ursprung 56a602ccee
Commit 46b5bb29cc
4 geänderte Dateien mit 28 neuen und 13 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -20,10 +20,13 @@
package de.steamwar.schematicsystem.autocheck;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import de.steamwar.schematicsystem.CheckSchemType;
import org.bukkit.Material;
@ -145,6 +148,7 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
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())
@ -156,6 +160,7 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
.records(blockScanResult.getRecords())
.forbiddenItems(blockScanResult.getForbiddenItems())
.forbiddenNbt(blockScanResult.getForbiddenNbt())
.entities(clipboard.getEntities().stream().map(Entity::getLocation).map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ())).collect(Collectors.toList()))
.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_ITEM=§7Forbidden Item: [{0}, {1}, {2}] -> §c{3}
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_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}

Datei anzeigen

@ -1,21 +1,21 @@
/*
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.autocheck;
@ -47,6 +47,7 @@ public class AutoCheckerResult {
private final List<BlockPos> records;
private final Map<BlockPos, Set<Material>> forbiddenItems;
private final Map<BlockPos, Set<Material>> forbiddenNbt;
private final List<BlockPos> entities;
public boolean isOk() {
return records.isEmpty() &&
@ -144,6 +145,9 @@ public class AutoCheckerResult {
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());
});
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()) {
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_AFTER_DEADLINE", p, type.getDeadline());
}