From 46b5bb29cc2fbe9eee6b248aa15fdb575f3ad0a6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 13 May 2023 17:58:07 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Add=20Entities=20to=20AutoPr=C3=BCfer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autocheck/AutoChecker15.java | 5 ++++ .../autocheck/AutoChecker8.java | 5 ++++ .../src/SchematicSystem.properties | 1 + .../autocheck/AutoCheckerResult.java | 30 +++++++++++-------- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java index 257a077..6f0a109 100644 --- a/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java +++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java @@ -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 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(); } diff --git a/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java b/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java index adaff94..306fc2c 100644 --- a/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java +++ b/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java @@ -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(); } diff --git a/SchematicSystem_Core/src/SchematicSystem.properties b/SchematicSystem_Core/src/SchematicSystem.properties index 60acc26..e6a14f2 100644 --- a/SchematicSystem_Core/src/SchematicSystem.properties +++ b/SchematicSystem_Core/src/SchematicSystem.properties @@ -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} diff --git a/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoCheckerResult.java b/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoCheckerResult.java index 989fd97..c7eb4df 100644 --- a/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoCheckerResult.java +++ b/SchematicSystem_Core/src/de/steamwar/schematicsystem/autocheck/AutoCheckerResult.java @@ -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 . -*/ + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + */ package de.steamwar.schematicsystem.autocheck; @@ -47,6 +47,7 @@ public class AutoCheckerResult { private final List records; private final Map> forbiddenItems; private final Map> forbiddenNbt; + private final List 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()); } -- 2.39.2 From 31eeac12175f9b304c4a231bb64a24b4a23e806d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 13 May 2023 17:58:58 +0200 Subject: [PATCH 2/2] Remove Unused Imports --- .../de/steamwar/schematicsystem/autocheck/AutoChecker15.java | 2 -- .../src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java | 2 -- 2 files changed, 4 deletions(-) diff --git a/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java b/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java index 6f0a109..7ed4310 100644 --- a/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java +++ b/SchematicSystem_15/src/de/steamwar/schematicsystem/autocheck/AutoChecker15.java @@ -23,8 +23,6 @@ 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; diff --git a/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java b/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java index 306fc2c..c2a10e7 100644 --- a/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java +++ b/SchematicSystem_8/src/de/steamwar/schematicsystem/autocheck/AutoChecker8.java @@ -20,13 +20,11 @@ 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; -- 2.39.2