Remove debug output

This commit is contained in:
2026-08-26 22:35:39 +02:00
parent 97c1da1b2a
commit d307f890e2
3 changed files with 16 additions and 23 deletions
@@ -733,7 +733,7 @@ public final class GameModeConfig<M, W> {
Set<M> blocks = new HashSet<>(); Set<M> blocks = new HashSet<>();
for (YMLWrapper<M, ?> limitedLoader : loader.withAsList("Limited")) { for (YMLWrapper<M, ?> limitedLoader : loader.withAsList("Limited")) {
BlockRule<M> blockRule = new BlockRule<>(limitedLoader); BlockRule<M> blockRule = new BlockRule<>(limitedLoader);
blocks.addAll(blockRule.Blocks); blocks.addAll(blockRule.Materials);
limited.add(blockRule); limited.add(blockRule);
} }
for (M material : (List<M>) SQLWrapper.impl.getMaterialWithGreaterBlastResistance(MaxBlastResistance)) { for (M material : (List<M>) SQLWrapper.impl.getMaterialWithGreaterBlastResistance(MaxBlastResistance)) {
@@ -752,21 +752,21 @@ public final class GameModeConfig<M, W> {
public int getMaxCount(M material) { public int getMaxCount(M material) {
return Limited.stream() return Limited.stream()
.filter(rule -> rule.Blocks.contains(material)) .filter(rule -> rule.Materials.contains(material))
.mapToInt(rule -> rule.MaxCount) .mapToInt(rule -> rule.Amount)
.max() .max()
.orElse(Integer.MAX_VALUE); .orElse(Integer.MAX_VALUE);
} }
public boolean isInventory(M material) { public boolean isInventory(M material) {
return Limited.stream() return Limited.stream()
.filter(rule -> rule.Blocks.contains(material)) .filter(rule -> rule.Materials.contains(material))
.anyMatch(rule -> rule.Content.loaded); .anyMatch(rule -> rule.Content.loaded);
} }
public Integer getItemAmount(M material, M item) { public Integer getItemAmount(M material, M item) {
return Limited.stream() return Limited.stream()
.filter(rule -> rule.Blocks.contains(material)) .filter(rule -> rule.Materials.contains(material))
.filter(rule -> rule.Content.Items.contains(item)) .filter(rule -> rule.Content.Items.contains(item))
.mapToInt(rule -> rule.Content.Amount) .mapToInt(rule -> rule.Content.Amount)
.max() .max()
@@ -779,14 +779,14 @@ public final class GameModeConfig<M, W> {
/** /**
* The block materials this rule applies to * The block materials this rule applies to
*/ */
public final Set<M> Blocks; public final Set<M> Materials;
/** /**
* Maximal amount of Blocks allowed in the schematic * Maximal amount of Blocks allowed in the schematic
* *
* @implSpec {@code 0} by default * @implSpec {@code 0} by default
*/ */
public final int MaxCount; public final int Amount;
/** /**
* The item content filter for Blocks * The item content filter for Blocks
@@ -813,23 +813,18 @@ public final class GameModeConfig<M, W> {
} }
private BlockRule(YMLWrapper<M, ?> loader) { private BlockRule(YMLWrapper<M, ?> loader) {
List<M> blocks = loader.getStringList("Blocks") Set<M> blocks = loader.getStringList("Materials")
.stream() .stream()
.flatMap(value -> expandInventoryGroup(loader, value).stream()) .flatMap(value -> expandInventoryGroup(loader, value).stream())
.collect(Collectors.toList()); .collect(Collectors.toSet());
if (blocks.isEmpty()) { // Legacy support Materials = Collections.unmodifiableSet(blocks);
blocks = loader.getMaterialList("Materials"); Amount = loader.getInt("Amount", 0);
}
Blocks = Collections.unmodifiableSet(new HashSet<>(blocks));
MaxCount = loader.getInt("MaxCount", // Legacy support
loader.getInt("Amount", 0)
);
Content = new Content<>(loader.with("Content")); Content = new Content<>(loader.with("Content"));
} }
private BlockRule(M block, int maxCount) { private BlockRule(M block, int amount) {
Blocks = Collections.singleton(block); Materials = Collections.singleton(block);
MaxCount = maxCount; Amount = amount;
Content = new Content<>(); Content = new Content<>();
} }
@@ -51,7 +51,6 @@ public class Check implements Listener {
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (gameModeConfig == null) gameModeConfig = GameModeConfig.getDefaults(); if (gameModeConfig == null) gameModeConfig = GameModeConfig.getDefaults();
System.out.println(gameModeConfig.GameName + " " + gameModeConfig.Checkers);
if (user.hasPerm(UserPerm.ADMINISTRATION)) return true; if (user.hasPerm(UserPerm.ADMINISTRATION)) return true;
if (gameModeConfig.Checkers.isEmpty() && user.hasPerm(UserPerm.CHECK)) return true; if (gameModeConfig.Checkers.isEmpty() && user.hasPerm(UserPerm.CHECK)) return true;
return gameModeConfig.Checkers.contains(user.getId()); return gameModeConfig.Checkers.contains(user.getId());
@@ -63,7 +62,6 @@ public class Check implements Listener {
SteamwarUser user = SteamwarUser.get(player.getUniqueId()); SteamwarUser user = SteamwarUser.get(player.getUniqueId());
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID); SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
System.out.println(player + " " + schem.getNodeOwner() + " " + " " + schem.getSchemtype() + " " + schem.getName());
if (checkPermission(user, schem)) return; if (checkPermission(user, schem)) return;
if (user.getId() == schem.getOwner()) return; if (user.getId() == schem.getOwner()) return;
@@ -243,8 +243,8 @@ public class SchematicCommand extends SWCommand {
if (!result.isLimitedBlocksOK()) { if (!result.isLimitedBlocksOK()) {
Set<Material> toReplace = type.Schematic.Limited.stream() Set<Material> toReplace = type.Schematic.Limited.stream()
.filter(rule -> rule.MaxCount == 0) .filter(rule -> rule.Amount == 0)
.flatMap(rule -> rule.Blocks.stream()) .flatMap(rule -> rule.Materials.stream())
.collect(Collectors.toSet()); .collect(Collectors.toSet());
BlockState replaceType = Objects.requireNonNull(toReplace.contains(Material.END_STONE) ? BlockTypes.IRON_BLOCK : BlockTypes.END_STONE).getDefaultState(); BlockState replaceType = Objects.requireNonNull(toReplace.contains(Material.END_STONE) ? BlockTypes.IRON_BLOCK : BlockTypes.END_STONE).getDefaultState();
BlockVector3 min = clipboard.getMinimumPoint(); BlockVector3 min = clipboard.getMinimumPoint();