This commit is contained in:
@@ -25,7 +25,7 @@ dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":SchematicSystem:SchematicSystem_Core", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
compileOnly(libs.spigotapi21)
|
||||
|
||||
compileOnly(libs.nms21)
|
||||
compileOnly(libs.fawe21)
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
|
||||
public AutoChecker.BlockScanResult scan(Clipboard clipboard) {
|
||||
public AutoChecker.BlockScanResult scan(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
AutoChecker.BlockScanResult result = new AutoChecker.BlockScanResult();
|
||||
BlockVector3 min = clipboard.getMinimumPoint();
|
||||
BlockVector3 max = clipboard.getMaximumPoint();
|
||||
@@ -49,7 +49,7 @@ public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
result.getBlockCounts().merge(material, 1, Integer::sum);
|
||||
|
||||
if (AutoCheckerItems.impl.getInventoryMaterials().contains(material)) {
|
||||
checkInventory(result, block, material, new BlockPos(x, y, z));
|
||||
checkInventory(result, block, material, new BlockPos(x, y, z), type);
|
||||
}
|
||||
|
||||
if (x == min.getBlockX() || x == max.getBlockX() || y == max.getBlockY() || z == min.getBlockZ() || z == max.getBlockZ()) {
|
||||
@@ -71,11 +71,10 @@ public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
Material.PINK_SHULKER_BOX, Material.PURPLE_SHULKER_BOX, Material.RED_SHULKER_BOX, Material.WHITE_SHULKER_BOX, Material.YELLOW_SHULKER_BOX));
|
||||
itemsInInv.put(Material.FIRE_CHARGE, EnumSet.of(Material.DISPENSER));
|
||||
itemsInInv.put(Material.ARROW, EnumSet.of(Material.DISPENSER));
|
||||
itemsInInv.put(Material.WIND_CHARGE, EnumSet.of(Material.DISPENSER));
|
||||
AutoCheckerItems.impl.getAllowedMaterialsInInventory().forEach(material -> itemsInInv.put(material, AutoCheckerItems.impl.getInventoryMaterials()));
|
||||
}
|
||||
|
||||
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos) {
|
||||
private void checkInventory(AutoChecker.BlockScanResult result, BaseBlock block, Material material, BlockPos pos, GameModeConfig<Material, String> type) {
|
||||
CompoundTag nbt = block.getNbtData();
|
||||
if (nbt == null) {
|
||||
result.getDefunctNbt().add(pos);
|
||||
@@ -93,6 +92,7 @@ public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
return; // Leeres Inventar
|
||||
|
||||
int counter = 0;
|
||||
int windChargeCount = 0;
|
||||
for (CompoundTag item : items) {
|
||||
if (!item.containsKey("id")) {
|
||||
result.getDefunctNbt().add(pos);
|
||||
@@ -103,7 +103,10 @@ public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
if (itemType == null) // Leere Slots
|
||||
continue;
|
||||
|
||||
if (!itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(material)) {
|
||||
if(type.Schematic.Type.equals("wargearseason26") && material == Material.DISPENSER && itemType == Material.WIND_CHARGE) {
|
||||
windChargeCount += item.getInt("count");
|
||||
}
|
||||
else if (!itemsInInv.getOrDefault(itemType, EnumSet.noneOf(Material.class)).contains(material)) {
|
||||
result.getForbiddenItems().computeIfAbsent(pos, blockVector3 -> new HashSet<>()).add(itemType);
|
||||
} else if (material == Material.DISPENSER && (itemType == Material.ARROW || itemType == Material.FIRE_CHARGE)) {
|
||||
counter += Core.getVersion() >= 21 ? item.getInt("count") : item.getByte("Count");
|
||||
@@ -113,12 +116,13 @@ public class AutoChecker21 implements AutoChecker.IAutoChecker {
|
||||
}
|
||||
}
|
||||
result.getDispenserItems().put(pos, counter);
|
||||
result.getWindChargeCount().put(pos, windChargeCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult check(Clipboard clipboard, GameModeConfig<Material, String> type) {
|
||||
return AutoCheckerResult.builder().type(type).height(clipboard.getDimensions().getBlockY()).width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ()).blockScanResult(scan(clipboard))
|
||||
.depth(clipboard.getDimensions().getBlockZ()).blockScanResult(scan(clipboard, type))
|
||||
.entities(clipboard.getEntities().stream().map(Entity::getLocation)
|
||||
.map(blockVector3 -> new BlockPos(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()))
|
||||
.collect(Collectors.toList()))
|
||||
|
||||
@@ -262,6 +262,8 @@ AUTO_CHECKER_RESULT_BLOCKS=§7Blocks: §c{0}§7, Max: §e{1}
|
||||
AUTO_CHECKER_RESULT_UNKNOWN_MATERIAL=§7Unknown block: §c{0}
|
||||
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_WIND_CHARGES=§7Windcharges: §c{0}§7, Max: §e2048
|
||||
AUTO_CHECKER_RESULT_WIND_CHARGES_DISPENSER=§7Dispenser: §c[{0}, {1}, {2}]§7, Windcharges: §c{3}§7
|
||||
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_DESIGN_BLOCK=§7{0} in Design: [{1}, {2}, {3}]
|
||||
|
||||
@@ -242,6 +242,8 @@ AUTO_CHECKER_RESULT_BLOCKS=§7Blöcke: §c{0}§7, Max: §e{1}
|
||||
AUTO_CHECKER_RESULT_UNKNOWN_MATERIAL=§7Unbekannter Block: §c{0}
|
||||
AUTO_CHECKER_RESULT_TOO_MANY_BLOCK=§7{0}: §c{1}§7, Max: §e{2}
|
||||
AUTO_CHECKER_RESULT_FORBIDDEN_BLOCK=§7Verbotener Block: §c{0}
|
||||
AUTO_CHECKER_RESULT_WIND_CHARGES=§7Windcharges: §c{0}§7, Max: §e2048
|
||||
AUTO_CHECKER_RESULT_WIND_CHARGES_DISPENSER=§7Werfer: §c[{0}, {1}, {2}]§7, Windcharges: §c{3}§7
|
||||
AUTO_CHECKER_RESULT_FORBIDDEN_ITEM=§7Verbotener gegenstand: [{0}, {1}, {2}] -> §c{3}
|
||||
AUTO_CHECKER_RESULT_DEFUNCT_NBT=§7Keine NBT-Daten: §c[{0}, {1}, {2}]
|
||||
AUTO_CHECKER_RESULT_DESIGN_BLOCK=§7{0} im Design: [{1}, {2}, {3}]
|
||||
|
||||
@@ -55,6 +55,7 @@ public class AutoChecker {
|
||||
private final List<BlockPos> records = new ArrayList<>();
|
||||
private final Map<Material, List<BlockPos>> designBlocks = new EnumMap<>(Material.class);
|
||||
private final Map<BlockPos, Integer> dispenserItems = new HashMap<>();
|
||||
private final Map<BlockPos, Integer> windChargeCount = new HashMap<>();
|
||||
private final Map<BlockPos, Set<Material>> forbiddenItems = new HashMap<>();
|
||||
private final Map<BlockPos, Set<Material>> forbiddenNbt = new HashMap<>();
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ public class AutoCheckerResult {
|
||||
isBlockCountOk() &&
|
||||
isLimitedBlocksOK() &&
|
||||
isDispenserItemsOK() &&
|
||||
isWindchargeCountOK() &&
|
||||
!type.isAfterDeadline() &&
|
||||
entities.isEmpty() &&
|
||||
isDesignBlastResistanceOK();
|
||||
@@ -62,8 +63,18 @@ public class AutoCheckerResult {
|
||||
!type.isAfterDeadline();
|
||||
}
|
||||
|
||||
public boolean isWindchargeCountOK() {
|
||||
if(type.Schematic.Type.equals("wargearseason26")) {
|
||||
int windChargesCount = blockScanResult.getWindChargeCount().values().stream().reduce(Integer::sum).orElse(0);
|
||||
return windChargesCount <= 2048;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDispenserItemsOK() {
|
||||
return blockScanResult.getDispenserItems().values().stream().allMatch(i -> i <= type.Schematic.MaxDispenserItems);
|
||||
return blockScanResult.getDispenserItems().values().stream().allMatch(i -> i <= type.Schematic.MaxDispenserItems);
|
||||
}
|
||||
|
||||
public boolean hasWarnings() {
|
||||
@@ -127,6 +138,19 @@ public class AutoCheckerResult {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(!isWindchargeCountOK()) {
|
||||
int windChargesCount = blockScanResult.getWindChargeCount().values().stream().reduce(Integer::sum).orElse(0);
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_WIND_CHARGES", p, windChargesCount, 2048);
|
||||
blockScanResult.getWindChargeCount().entrySet().stream().filter(blockVector3IntegerEntry -> blockVector3IntegerEntry.getValue() > 0).forEach(blockVector3IntegerEntry -> {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_WIND_CHARGES_DISPENSER", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockVector3IntegerEntry.getKey()),
|
||||
blockVector3IntegerEntry.getKey().getBlockX(),
|
||||
blockVector3IntegerEntry.getKey().getBlockY(),
|
||||
blockVector3IntegerEntry.getKey().getBlockZ(),
|
||||
blockVector3IntegerEntry.getValue());
|
||||
});
|
||||
}
|
||||
|
||||
blockScanResult.getDispenserItems().entrySet().stream().filter(blockVector3IntegerEntry -> blockVector3IntegerEntry.getValue() > type.Schematic.MaxDispenserItems).forEach(blockVector3IntegerEntry -> {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_TOO_MANY_DISPENSER_ITEMS", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockVector3IntegerEntry.getKey()),
|
||||
blockVector3IntegerEntry.getKey().getBlockX(),
|
||||
@@ -135,6 +159,7 @@ public class AutoCheckerResult {
|
||||
blockVector3IntegerEntry.getValue(),
|
||||
type.Schematic.MaxDispenserItems);
|
||||
});
|
||||
|
||||
blockScanResult.getRecords().forEach(blockVector3 -> {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_RECORD", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockVector3), blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
|
||||
});
|
||||
|
||||
@@ -101,7 +101,9 @@ dependencyResolutionManagement {
|
||||
library("hamcrest", "org.hamcrest:hamcrest:2.2")
|
||||
library("classindex", "org.atteo.classindex:classindex:3.13")
|
||||
|
||||
library("spigotapi", "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
|
||||
|
||||
library("spigotapi", "org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT")
|
||||
library("spigotapi21", "org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
|
||||
library("spigotannotations", "org.spigotmc:plugin-annotations:1.2.3-SNAPSHOT")
|
||||
library("paperapi", "io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
|
||||
library("paperapi21", "io.papermc.paper:paper-api:1.21.6-R0.1-SNAPSHOT")
|
||||
|
||||
Reference in New Issue
Block a user