forked from SteamWar/SteamWar
Format code
This commit is contained in:
@@ -63,17 +63,16 @@ public class AutoCheckerResult {
|
||||
}
|
||||
|
||||
public boolean isWindchargeCountOK() {
|
||||
if( type.Schematic.Type.getName().equals("wargearseason26")) {
|
||||
if (type.Schematic.Type.getName().equals("wargearseason26")) {
|
||||
int windChargesCount = blockScanResult.getWindChargeCount().values().stream().reduce(Integer::sum).orElse(0);
|
||||
return windChargesCount <= 2048;
|
||||
}
|
||||
else {
|
||||
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() {
|
||||
@@ -118,17 +117,20 @@ public class AutoCheckerResult {
|
||||
|
||||
public void sendErrorMessage(Player p, String schemName) {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_HEADER", p, schemName);
|
||||
if(isTooWide()) SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_WIDTH", p, width, type.Schematic.Size.x);
|
||||
if(isTooHigh()) SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_HEIGHT", p, height, type.Schematic.Size.y);
|
||||
if(isTooDeep()) SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_LENGTH", p, depth, type.Schematic.Size.z);
|
||||
if(type.Schematic.MaxBlocks != 0 && !isBlockCountOk()) {
|
||||
if (isTooWide())
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_WIDTH", p, width, type.Schematic.Size.x);
|
||||
if (isTooHigh())
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_HEIGHT", p, height, type.Schematic.Size.y);
|
||||
if (isTooDeep())
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_LENGTH", p, depth, type.Schematic.Size.z);
|
||||
if (type.Schematic.MaxBlocks != 0 && !isBlockCountOk()) {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_BLOCKS", p, blockScanResult.getBlockCounts().values().stream().reduce(Integer::sum).orElse(0), type.Schematic.MaxBlocks);
|
||||
}
|
||||
if(!isLimitedBlocksOK()) {
|
||||
if (!isLimitedBlocksOK()) {
|
||||
type.Schematic.Limited.forEach((materials, integer) -> {
|
||||
for (Material mat : materials) {
|
||||
if(mat != null && blockScanResult.getBlockCounts().getOrDefault(mat, 0) > integer) {
|
||||
if(integer == 0) {
|
||||
if (mat != null && blockScanResult.getBlockCounts().getOrDefault(mat, 0) > integer) {
|
||||
if (integer == 0) {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_FORBIDDEN_BLOCK", p, mat.name());
|
||||
} else {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_TOO_MANY_BLOCK", p, mat.name(), blockScanResult.getBlockCounts().getOrDefault(mat, 0), integer);
|
||||
@@ -138,7 +140,7 @@ public class AutoCheckerResult {
|
||||
});
|
||||
}
|
||||
|
||||
if(!isWindchargeCountOK()) {
|
||||
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 -> {
|
||||
@@ -173,7 +175,7 @@ public class AutoCheckerResult {
|
||||
});
|
||||
blockScanResult.getDesignBlocks().forEach((material, poss) -> {
|
||||
if (material == Material.WATER || material == Material.LAVA) return;
|
||||
if(material.getBlastResistance() > type.Schematic.MaxDesignBlastResistance) {
|
||||
if (material.getBlastResistance() > type.Schematic.MaxDesignBlastResistance) {
|
||||
poss.forEach(pos -> {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_DESIGN_BLOCK", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(pos), material.name(), pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||
});
|
||||
@@ -182,7 +184,7 @@ public class AutoCheckerResult {
|
||||
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.Deadline);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user