Commits vergleichen
1 Commits
Autor | SHA1 | Datum | |
---|---|---|---|
|
184e2e7480 |
@ -90,6 +90,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
||||
for(int x = min.getBlockX(); x <= max.getBlockX(); x++){
|
||||
for(int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
||||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
|
||||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
final BaseBlock block = clipboard.getFullBlock(BlockVector3.at(x, y, z));
|
||||
final Material material = Material.matchMaterial(block.getBlockType().getId());
|
||||
if(material == null) {
|
||||
@ -99,11 +100,7 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
||||
result.getBlockCounts().merge(material, 1, Integer::sum);
|
||||
|
||||
if(INVENTORY.contains(material)) {
|
||||
checkInventory(result, block, material, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
if(x == 0 || x == max.getBlockX() - 1 || y == max.getBlockY() - 1 || z == 0 || z == max.getBlockZ() - 1) {
|
||||
result.getDesignBlocks().computeIfAbsent(material, m -> new ArrayList<>()).add(new BlockPos(x, y, z));
|
||||
checkInventory(result, block, material, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,12 +160,18 @@ public class AutoChecker15 implements AutoChecker.IAutoChecker {
|
||||
|
||||
@Override
|
||||
public AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
|
||||
AutoChecker.BlockScanResult blockScanResult = scan(clipboard);
|
||||
return AutoCheckerResult.builder()
|
||||
.type(type)
|
||||
.height(clipboard.getDimensions().getBlockY())
|
||||
.width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ())
|
||||
.blockScanResult(scan(clipboard))
|
||||
.blockCounts(blockScanResult.getBlockCounts())
|
||||
.defunctNbt(blockScanResult.getDefunctNbt())
|
||||
.dispenserItems(blockScanResult.getDispenserItems())
|
||||
.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();
|
||||
}
|
||||
|
@ -43,15 +43,15 @@ import java.util.stream.Collectors;
|
||||
public class SchematicCommand15 implements SchematicCommand.ISchematicCommand {
|
||||
@Override
|
||||
public Clipboard fixClipboard(Clipboard clipboard, AutoCheckerResult result, CheckSchemType type) throws Exception {
|
||||
for (BlockPos blockPos : result.getBlockScanResult().getRecords()) {
|
||||
for (BlockPos blockPos : result.getRecords()) {
|
||||
BlockVector3 vector = BlockVector3.at(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
clipboard.setBlock(vector, clipboard.getFullBlock(vector).toBaseBlock(new CompoundTag(Collections.emptyMap())));
|
||||
}
|
||||
|
||||
Map<BlockPos, Set<Material>> toBeCheckedInvs = new HashMap<>();
|
||||
|
||||
toBeCheckedInvs.putAll(result.getBlockScanResult().getForbiddenItems());
|
||||
toBeCheckedInvs.putAll(result.getBlockScanResult().getForbiddenNbt());
|
||||
toBeCheckedInvs.putAll(result.getForbiddenItems());
|
||||
toBeCheckedInvs.putAll(result.getForbiddenNbt());
|
||||
|
||||
for (Map.Entry<BlockPos, Set<Material>> entry: toBeCheckedInvs.entrySet()) {
|
||||
BlockPos pos = entry.getKey();
|
||||
@ -77,7 +77,7 @@ public class SchematicCommand15 implements SchematicCommand.ISchematicCommand {
|
||||
}
|
||||
|
||||
if(type.getMaxDispenserItems() > 0 ) {
|
||||
for (Map.Entry<BlockPos, Integer> entry : result.getBlockScanResult().getDispenserItems().entrySet()) {
|
||||
for (Map.Entry<BlockPos, Integer> entry : result.getDispenserItems().entrySet()) {
|
||||
if(entry.getValue() <= type.getMaxDispenserItems()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -74,17 +74,12 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
||||
for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++){
|
||||
final BaseBlock block = clipboard.getBlock(new Vector(x, y, z));
|
||||
final int blockId = block.getId();
|
||||
final Material material = Material.getMaterial(blockId);
|
||||
|
||||
result.getBlockCounts().merge(material, 1, Integer::sum);
|
||||
result.getBlockCounts().merge(Material.getMaterial(blockId), 1, Integer::sum);
|
||||
|
||||
if(INVENTORY.contains(blockId)){
|
||||
checkInventory(result, block, blockId, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
if(x == 0 || x == max.getBlockX() - 1 || y == max.getBlockY() - 1 || z == 0 || z == max.getBlockZ() - 1) {
|
||||
result.getDesignBlocks().computeIfAbsent(material, m -> new ArrayList<>()).add(new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,7 +152,12 @@ public class AutoChecker8 implements AutoChecker.IAutoChecker {
|
||||
.height(clipboard.getDimensions().getBlockY())
|
||||
.width(clipboard.getDimensions().getBlockX())
|
||||
.depth(clipboard.getDimensions().getBlockZ())
|
||||
.blockScanResult(blockScanResult)
|
||||
.blockCounts(blockScanResult.getBlockCounts())
|
||||
.defunctNbt(blockScanResult.getDefunctNbt())
|
||||
.dispenserItems(blockScanResult.getDispenserItems())
|
||||
.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();
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ UTIL_TYPE_FIGHT_ALREADY=§cYou have already submitted this schematic
|
||||
UTIL_TYPE_AFTER_DEADLINE=§cSchematics of this type can no longer be submitted. Deadline was: {0}
|
||||
UTIL_TYPE_ERROR=§cThe Schematic is not compliant with the rules
|
||||
UTIL_TYPE_EXTEND=§aThe preparation server is starting
|
||||
UTIL_TYPE_CANNOT_EXTEND=§cThis schematic type cannot be extended
|
||||
UTIL_SUBMIT_TITLE=Extend Schematic
|
||||
UTIL_SUBMIT_REPLAY_ON=§aReplay allowed
|
||||
UTIL_SUBMIT_REPLAY_OFF=§cReplay locked
|
||||
@ -100,6 +101,7 @@ UTIL_SUBMIT_COLOR_OFF=§cDo not replace pink
|
||||
UTIL_SUBMIT_DIRECT=§eSubmit directly
|
||||
UTIL_SUBMIT_DIRECT_DONE=§aThe Schematic will be reviewed in a timely manner
|
||||
UTIL_SUBMIT_EXTEND=§eExtend Schematic
|
||||
UTIL_SUBMIT_EXTEND_NO=§cYou cannot extend this schematic
|
||||
UTIL_SUBMIT_EXTEND_DONE=§aThe preparation server is starting
|
||||
UTIL_CHECK_TYPE_NOT_FOUND=§cThe type {0} was not found
|
||||
UTIL_CHECK_SUCCESS=§aThe schematic was checked successfully
|
||||
@ -255,7 +257,6 @@ 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_DESIGN_BLOCK=§7{0} in Design: [{1}, {2}, {3}]
|
||||
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}
|
||||
|
@ -79,6 +79,7 @@ UTIL_TYPE_FIGHT_ALREADY=§cDu hast diese Schematic bereits eingesendet
|
||||
UTIL_TYPE_AFTER_DEADLINE=§cVon diesem Typen können keine Schematics mehr eingesendet werden. Einsendeschluss war: {0}
|
||||
UTIL_TYPE_ERROR=§cDie Schematic ist nicht regelkonform
|
||||
UTIL_TYPE_EXTEND=§aDer Vorbereitungsserver wird gestartet
|
||||
UTIL_TYPE_CANNOT_EXTEND=§cDieser Schematictyp kann nicht ausgefahren werden
|
||||
UTIL_SUBMIT_TITLE=Schematic ausfahren
|
||||
UTIL_SUBMIT_REPLAY_ON=§aReplay erlaubt
|
||||
UTIL_SUBMIT_REPLAY_OFF=§cReplay gesperrt
|
||||
@ -87,6 +88,7 @@ UTIL_SUBMIT_COLOR_OFF=§cPink nicht ersetzen
|
||||
UTIL_SUBMIT_DIRECT=§eDirekt einsenden
|
||||
UTIL_SUBMIT_DIRECT_DONE=§aDie Schematic wird zeitnah überprüft
|
||||
UTIL_SUBMIT_EXTEND=§eSchematic ausfahren
|
||||
UTIL_SUBMIT_EXTEND_NO=§cDiese Schematic kann nicht ausgefahren werden
|
||||
UTIL_SUBMIT_EXTEND_DONE=§aDer Vorbereitungsserver wird gestartet
|
||||
|
||||
COMMAND_INVALID_NODE=§cDie Schematic konnte nicht gefunden werden
|
||||
@ -235,7 +237,6 @@ 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_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}]
|
||||
AUTO_CHECKER_RESULT_RECORD=§7Schallplatte: §c[{0}, {1}, {2}]
|
||||
AUTO_CHECKER_RESULT_TOO_MANY_DISPENSER_ITEMS=§7Dispenser: §c[{0}, {1}, {2}]§7, §c{3} §7gegenstände, Max: §e{4}
|
||||
AUTO_CHECKER_RESULT_FORBIDDEN_ITEM_NBT=§7Verbotene NBT-Daten: [{0}, {1}, {2}] -> §c{3}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 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
|
||||
@ -25,7 +25,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
@ -43,11 +42,12 @@ public class CheckSchemType {
|
||||
|
||||
private final Map<Set<String>, Integer> limits;
|
||||
private final int maxBlocks;
|
||||
|
||||
private final Date deadline;
|
||||
private final float maxBlastResistance;
|
||||
private final boolean hasCheckQuestions;
|
||||
|
||||
private CheckSchemType(ConfigurationSection section) {
|
||||
hasCheckQuestions = section.isList("CheckQuestions");
|
||||
|
||||
String name = section.getString("Schematic.Type");
|
||||
width = section.getInt("Schematic.Size.x");
|
||||
height = section.getInt("Schematic.Size.y");
|
||||
@ -56,8 +56,6 @@ public class CheckSchemType {
|
||||
maxDispenserItems = section.getInt("Schematic.MaxDispenserItems", 128);
|
||||
maxBlocks = section.getInt("Schematic.MaxBlocks", 0);
|
||||
|
||||
maxBlastResistance = (float) section.getDouble("Schematic.MaxDesignBlastResistance", Double.MAX_VALUE);
|
||||
|
||||
limits = new HashMap<>();
|
||||
for(Map<?, ?> entry : section.getMapList("Schematic.Limited")) {
|
||||
int amount = (Integer) entry.get("Amount");
|
||||
@ -91,7 +89,7 @@ public class CheckSchemType {
|
||||
if(folder.exists()) {
|
||||
for(File configFile : folder.listFiles((file, name) -> name.endsWith(".yml") && !name.endsWith(".kits.yml"))) {
|
||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
|
||||
if (!config.isList("CheckQuestions") && config.getBoolean("Schematic.ManualCheck", true))
|
||||
if (!config.isList("CheckQuestions"))
|
||||
continue;
|
||||
|
||||
new CheckSchemType(config);
|
||||
|
@ -52,7 +52,6 @@ public class AutoChecker {
|
||||
private final Map<Material, Integer> blockCounts = new EnumMap<>(Material.class);
|
||||
private final List<BlockPos> defunctNbt = new ArrayList<>();
|
||||
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, Set<Material>> forbiddenItems = new HashMap<>();
|
||||
private final Map<BlockPos, Set<Material>> forbiddenNbt = new HashMap<>();
|
||||
|
@ -28,7 +28,10 @@ import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
@ -38,20 +41,23 @@ public class AutoCheckerResult {
|
||||
private final int width;
|
||||
private final int height;
|
||||
private final int depth;
|
||||
private final AutoChecker.BlockScanResult blockScanResult;
|
||||
private final Map<Material, Integer> blockCounts;
|
||||
private final List<BlockPos> defunctNbt;
|
||||
private final Map<BlockPos, Integer> dispenserItems;
|
||||
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 blockScanResult.getRecords().isEmpty() &&
|
||||
blockScanResult.getForbiddenItems().isEmpty() &&
|
||||
blockScanResult.getForbiddenNbt().isEmpty() &&
|
||||
return records.isEmpty() &&
|
||||
forbiddenItems.isEmpty() &&
|
||||
forbiddenNbt.isEmpty() &&
|
||||
isSizeOk() &&
|
||||
isBlockCountOk() &&
|
||||
isLimitedBlocksOK() &&
|
||||
isDispenserItemsOK() &&
|
||||
!type.isAfterDeadline() &&
|
||||
entities.isEmpty() &&
|
||||
isDesignBlastResistanceOK();
|
||||
!type.isAfterDeadline();
|
||||
}
|
||||
|
||||
public boolean fastOk() {
|
||||
@ -60,11 +66,11 @@ public class AutoCheckerResult {
|
||||
}
|
||||
|
||||
public boolean isDispenserItemsOK() {
|
||||
return blockScanResult.getDispenserItems().values().stream().allMatch(i -> i <= type.getMaxDispenserItems());
|
||||
return dispenserItems.values().stream().allMatch(i -> i <= type.getMaxDispenserItems());
|
||||
}
|
||||
|
||||
public boolean hasWarnings() {
|
||||
return blockScanResult.getDefunctNbt().isEmpty();
|
||||
return defunctNbt.isEmpty();
|
||||
}
|
||||
|
||||
public boolean isSizeOk() {
|
||||
@ -84,46 +90,42 @@ public class AutoCheckerResult {
|
||||
}
|
||||
|
||||
public boolean isBlockCountOk() {
|
||||
return type.getMaxBlocks() == 0 || blockScanResult.getBlockCounts().entrySet().stream().filter(entry -> entry.getKey() != Material.AIR).map(Map.Entry::getValue).reduce(Integer::sum).map(i -> i <= type.getMaxBlocks()).orElse(false);
|
||||
return type.getMaxBlocks() == 0 || blockCounts.entrySet().stream().filter(entry -> entry.getKey() != Material.AIR).map(Map.Entry::getValue).reduce(Integer::sum).map(i -> i <= type.getMaxBlocks()).orElse(false);
|
||||
}
|
||||
|
||||
public boolean isLimitedBlocksOK() {
|
||||
try {
|
||||
return type.getLimits().entrySet().stream()
|
||||
.map(setIntegerEntry -> setIntegerEntry.getKey().stream().map(Material::getMaterial).map(blockScanResult.getBlockCounts()::get).map(i -> i == null || i <= setIntegerEntry.getValue()).reduce(Boolean::logicalAnd).orElse(false))
|
||||
.map(setIntegerEntry -> setIntegerEntry.getKey().stream().map(Material::getMaterial).map(blockCounts::get).map(i -> i == null || i <= setIntegerEntry.getValue()).reduce(Boolean::logicalAnd).orElse(false))
|
||||
.reduce(Boolean::logicalAnd).orElse(true);
|
||||
} catch (NullPointerException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDesignBlastResistanceOK() {
|
||||
return blockScanResult.getDesignBlocks().keySet().stream().map(Material::getBlastResistance).noneMatch(i -> i > type.getMaxBlastResistance());
|
||||
}
|
||||
|
||||
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.getWidth());
|
||||
if(isTooHigh()) SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_HEIGHT", p, height, type.getHeight());
|
||||
if(isTooDeep()) SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_LENGTH", p, depth, type.getDepth());
|
||||
if(type.getMaxBlocks() != 0 && !isBlockCountOk()) {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_BLOCKS", p, blockScanResult.getBlockCounts().values().stream().reduce(Integer::sum).orElse(0), type.getMaxBlocks());
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_BLOCKS", p, blockCounts.values().stream().reduce(Integer::sum).orElse(0), type.getMaxBlocks());
|
||||
}
|
||||
if(!isLimitedBlocksOK()) {
|
||||
type.getLimits().forEach((strings, integer) -> {
|
||||
for (String string : strings) {
|
||||
Material mat = Material.matchMaterial(string);
|
||||
if(mat != null && blockScanResult.getBlockCounts().getOrDefault(mat, 0) > integer) {
|
||||
if(mat != null && blockCounts.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);
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_TOO_MANY_BLOCK", p, mat.name(), blockCounts.getOrDefault(mat, 0), integer);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
blockScanResult.getDispenserItems().entrySet().stream().filter(blockVector3IntegerEntry -> blockVector3IntegerEntry.getValue() > type.getMaxDispenserItems()).forEach(blockVector3IntegerEntry -> {
|
||||
dispenserItems.entrySet().stream().filter(blockVector3IntegerEntry -> blockVector3IntegerEntry.getValue() > type.getMaxDispenserItems()).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(),
|
||||
blockVector3IntegerEntry.getKey().getBlockY(),
|
||||
@ -131,25 +133,18 @@ public class AutoCheckerResult {
|
||||
blockVector3IntegerEntry.getValue(),
|
||||
type.getMaxDispenserItems());
|
||||
});
|
||||
blockScanResult.getRecords().forEach(blockVector3 -> {
|
||||
records.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());
|
||||
});
|
||||
blockScanResult.getForbiddenItems().forEach((blockVector3, materials) -> {
|
||||
forbiddenItems.forEach((blockVector3, materials) -> {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_FORBIDDEN_ITEM", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockVector3), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ(), setToString(materials));
|
||||
});
|
||||
blockScanResult.getForbiddenNbt().forEach((blockVector3, materials) -> {
|
||||
forbiddenNbt.forEach((blockVector3, materials) -> {
|
||||
SchematicSystem.MESSAGE.sendPrefixless("AUTO_CHECKER_RESULT_FORBIDDEN_ITEM_NBT", p, SchematicSystem.MESSAGE.parse("AUTO_CHECKER_RESULT_TELEPORT_HERE", p), tpCommandTo(blockVector3), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ(), setToString(materials));
|
||||
});
|
||||
blockScanResult.getDefunctNbt().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());
|
||||
});
|
||||
blockScanResult.getDesignBlocks().forEach((material, poss) -> {
|
||||
if(material.getBlastResistance() > type.getMaxBlastResistance()) {
|
||||
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());
|
||||
});
|
||||
}
|
||||
});
|
||||
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());
|
||||
});
|
||||
|
@ -27,6 +27,7 @@ import de.steamwar.schematicsystem.CheckSchemType;
|
||||
import de.steamwar.schematicsystem.SchematicSystem;
|
||||
import de.steamwar.schematicsystem.autocheck.AutoCheckerResult;
|
||||
import de.steamwar.sql.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -37,7 +38,7 @@ import static de.steamwar.schematicsystem.commands.schematiccommand.SchematicCom
|
||||
public class SchematicCommand extends SWCommand {
|
||||
|
||||
public SchematicCommand() {
|
||||
super("schematic", new String[] {"schem", "/schem", "/schematic"});
|
||||
super("schematic", Bukkit.getPluginManager().getPlugin("Teamserver") == null ? new String[] {"schem", "/schem", "/schematic"} : new String[]{"schem"});
|
||||
}
|
||||
|
||||
@Register("help")
|
||||
|
@ -458,6 +458,11 @@ public class SchematicCommandUtils {
|
||||
if (extend == null) {
|
||||
submitSchemGUI(player, node, type);
|
||||
} else if (extend == SchematicCommand.Extend.AUSFAHREN) {
|
||||
if (checkSchemType.isHasCheckQuestions()) {
|
||||
SchematicSystem.MESSAGE.send("UTIL_TYPE_CANNOT_EXTEND", player);
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkSender.send(new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()).getId(), node.getId(), type.toDB()));
|
||||
SchematicSystem.MESSAGE.send("UTIL_TYPE_EXTEND", player);
|
||||
}
|
||||
@ -479,11 +484,15 @@ public class SchematicCommandUtils {
|
||||
SchematicSystem.MESSAGE.send("UTIL_SUBMIT_DIRECT_DONE", player);
|
||||
player.closeInventory();
|
||||
});
|
||||
if (CheckSchemType.get(type).isHasCheckQuestions()) {
|
||||
inv.setItem(8, SWItem.getDye(8), (byte) 8, SchematicSystem.MESSAGE.parse("UTIL_SUBMIT_EXTEND_NO", player), clickType -> {});
|
||||
} else {
|
||||
inv.setItem(8, SWItem.getDye(10), (byte) 10, SchematicSystem.MESSAGE.parse("UTIL_SUBMIT_EXTEND", player), click -> {
|
||||
NetworkSender.send(new PrepareSchemPacket(SteamwarUser.get(player.getUniqueId()).getId(), node.getId(), type.toDB()));
|
||||
SchematicSystem.MESSAGE.send("UTIL_SUBMIT_EXTEND_DONE", player);
|
||||
player.closeInventory();
|
||||
});
|
||||
}
|
||||
inv.setCallback(-999, click -> player.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class MemberPart extends SWCommand {
|
||||
public void addTeam(Player player, @Validator("isOwnerValidator") SchematicNode node) {
|
||||
SteamwarUser user = getUser(player);
|
||||
Team team = Team.get(user.getTeam());
|
||||
if (team == null || team.getTeamId() == 0) {
|
||||
if (team == null) {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_ADD_TEAM_NOT_IN_TEAM", player);
|
||||
return;
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class MemberPart extends SWCommand {
|
||||
public void remTeam(Player player, @Validator("isOwnerValidator") SchematicNode node) {
|
||||
SteamwarUser user = getUser(player);
|
||||
Team team = Team.get(user.getTeam());
|
||||
if (team == null || team.getTeamId() == 0) {
|
||||
if (team == null) {
|
||||
SchematicSystem.MESSAGE.send("COMMAND_DEL_TEAM_NOT_IN_TEAM", player);
|
||||
return;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
@ -51,7 +50,6 @@ public class SearchPart extends SWCommand {
|
||||
Class<?> clazz = Material.class;
|
||||
searchMapper.put("-item", SWCommandUtils.createEnumMapper((Class<Enum<?>>) clazz));
|
||||
searchMapper.put("-public", null);
|
||||
searchMapper.put("-ignoreCase", null);
|
||||
searchMapper.put("-exclude", SWCommandUtils.createMapper(Function.identity(), (commandSender, s) -> Collections.singletonList(s)));
|
||||
searchMapper.put("-excludeType", SWCommandUtils.createMapper(SchematicType.values().stream().map(SchematicType::name).toArray(String[]::new)));
|
||||
searchMapper.put("-excludeOwner", SWCommandUtils.createMapper(Function.identity(), (commandSender, s) -> Collections.singletonList(s)));
|
||||
@ -61,13 +59,6 @@ public class SearchPart extends SWCommand {
|
||||
super(null);
|
||||
}
|
||||
|
||||
public boolean containsCheckCase(String s, String s2, AtomicBoolean isIgnoreCase) {
|
||||
if (isIgnoreCase.get()) {
|
||||
return s.toLowerCase().contains(s2.toLowerCase());
|
||||
}
|
||||
return s.contains(s2);
|
||||
}
|
||||
|
||||
@Register("search")
|
||||
public void schemSearch(Player player, @OptionalValue("1") int page, @Mapper("searchMapper") String... query) {
|
||||
SteamwarUser user = getUser(player);
|
||||
@ -75,20 +66,12 @@ public class SearchPart extends SWCommand {
|
||||
List<Predicate<SchematicNode>> predicates = new ArrayList<>();
|
||||
List<String> nameList = new ArrayList<>();
|
||||
int i = 0;
|
||||
AtomicBoolean isIgnoreCase = new AtomicBoolean(false);
|
||||
while (i < query.length) {
|
||||
String current = query[i];
|
||||
if (searchMapper.containsKey(current)) {
|
||||
if (searchMapper.get(current) == null) {
|
||||
switch (current) {
|
||||
case "-public":
|
||||
if (current.equals("-public")) {
|
||||
userId = 0;
|
||||
break;
|
||||
case "-ignoreCase":
|
||||
isIgnoreCase.set(true);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + current);
|
||||
}
|
||||
} else if (i + 1 < query.length) {
|
||||
int finalI = i;
|
||||
@ -121,13 +104,11 @@ public class SearchPart extends SWCommand {
|
||||
}
|
||||
predicates.add(node -> node.getOwner() != steamwarUser1.getId());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + current);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
predicates.add(node -> containsCheckCase(node.getName(), current, isIgnoreCase));
|
||||
predicates.add(node -> node.getName().contains(current));
|
||||
nameList.add(current);
|
||||
}
|
||||
i++;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren