forked from SteamWar/SteamWar
Remove debug output
This commit is contained in:
@@ -733,7 +733,7 @@ public final class GameModeConfig<M, W> {
|
||||
Set<M> blocks = new HashSet<>();
|
||||
for (YMLWrapper<M, ?> limitedLoader : loader.withAsList("Limited")) {
|
||||
BlockRule<M> blockRule = new BlockRule<>(limitedLoader);
|
||||
blocks.addAll(blockRule.Blocks);
|
||||
blocks.addAll(blockRule.Materials);
|
||||
limited.add(blockRule);
|
||||
}
|
||||
for (M material : (List<M>) SQLWrapper.impl.getMaterialWithGreaterBlastResistance(MaxBlastResistance)) {
|
||||
@@ -752,21 +752,21 @@ public final class GameModeConfig<M, W> {
|
||||
|
||||
public int getMaxCount(M material) {
|
||||
return Limited.stream()
|
||||
.filter(rule -> rule.Blocks.contains(material))
|
||||
.mapToInt(rule -> rule.MaxCount)
|
||||
.filter(rule -> rule.Materials.contains(material))
|
||||
.mapToInt(rule -> rule.Amount)
|
||||
.max()
|
||||
.orElse(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public boolean isInventory(M material) {
|
||||
return Limited.stream()
|
||||
.filter(rule -> rule.Blocks.contains(material))
|
||||
.filter(rule -> rule.Materials.contains(material))
|
||||
.anyMatch(rule -> rule.Content.loaded);
|
||||
}
|
||||
|
||||
public Integer getItemAmount(M material, M item) {
|
||||
return Limited.stream()
|
||||
.filter(rule -> rule.Blocks.contains(material))
|
||||
.filter(rule -> rule.Materials.contains(material))
|
||||
.filter(rule -> rule.Content.Items.contains(item))
|
||||
.mapToInt(rule -> rule.Content.Amount)
|
||||
.max()
|
||||
@@ -779,14 +779,14 @@ public final class GameModeConfig<M, W> {
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @implSpec {@code 0} by default
|
||||
*/
|
||||
public final int MaxCount;
|
||||
public final int Amount;
|
||||
|
||||
/**
|
||||
* The item content filter for Blocks
|
||||
@@ -813,23 +813,18 @@ public final class GameModeConfig<M, W> {
|
||||
}
|
||||
|
||||
private BlockRule(YMLWrapper<M, ?> loader) {
|
||||
List<M> blocks = loader.getStringList("Blocks")
|
||||
Set<M> blocks = loader.getStringList("Materials")
|
||||
.stream()
|
||||
.flatMap(value -> expandInventoryGroup(loader, value).stream())
|
||||
.collect(Collectors.toList());
|
||||
if (blocks.isEmpty()) { // Legacy support
|
||||
blocks = loader.getMaterialList("Materials");
|
||||
}
|
||||
Blocks = Collections.unmodifiableSet(new HashSet<>(blocks));
|
||||
MaxCount = loader.getInt("MaxCount", // Legacy support
|
||||
loader.getInt("Amount", 0)
|
||||
);
|
||||
.collect(Collectors.toSet());
|
||||
Materials = Collections.unmodifiableSet(blocks);
|
||||
Amount = loader.getInt("Amount", 0);
|
||||
Content = new Content<>(loader.with("Content"));
|
||||
}
|
||||
|
||||
private BlockRule(M block, int maxCount) {
|
||||
Blocks = Collections.singleton(block);
|
||||
MaxCount = maxCount;
|
||||
private BlockRule(M block, int amount) {
|
||||
Materials = Collections.singleton(block);
|
||||
Amount = amount;
|
||||
Content = new Content<>();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ public class Check implements Listener {
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (gameModeConfig == null) gameModeConfig = GameModeConfig.getDefaults();
|
||||
System.out.println(gameModeConfig.GameName + " " + gameModeConfig.Checkers);
|
||||
if (user.hasPerm(UserPerm.ADMINISTRATION)) return true;
|
||||
if (gameModeConfig.Checkers.isEmpty() && user.hasPerm(UserPerm.CHECK)) return true;
|
||||
return gameModeConfig.Checkers.contains(user.getId());
|
||||
@@ -63,7 +62,6 @@ public class Check implements Listener {
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
System.out.println(player + " " + schem.getNodeOwner() + " " + " " + schem.getSchemtype() + " " + schem.getName());
|
||||
if (checkPermission(user, schem)) return;
|
||||
if (user.getId() == schem.getOwner()) return;
|
||||
|
||||
|
||||
+2
-2
@@ -243,8 +243,8 @@ public class SchematicCommand extends SWCommand {
|
||||
|
||||
if (!result.isLimitedBlocksOK()) {
|
||||
Set<Material> toReplace = type.Schematic.Limited.stream()
|
||||
.filter(rule -> rule.MaxCount == 0)
|
||||
.flatMap(rule -> rule.Blocks.stream())
|
||||
.filter(rule -> rule.Amount == 0)
|
||||
.flatMap(rule -> rule.Materials.stream())
|
||||
.collect(Collectors.toSet());
|
||||
BlockState replaceType = Objects.requireNonNull(toReplace.contains(Material.END_STONE) ? BlockTypes.IRON_BLOCK : BlockTypes.END_STONE).getDefaultState();
|
||||
BlockVector3 min = clipboard.getMinimumPoint();
|
||||
|
||||
Reference in New Issue
Block a user