Skip to content
Permalink
Browse files

Skip known bad lines in block syntax

  • Loading branch information...
me4502 committed Feb 26, 2019
1 parent 98ee4db commit 8423ef5dfd56f1d0b9a86761c18b18a02c00567a
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/main/java/com/sk89q/craftbook/util/BlockSyntax.java
@@ -28,12 +28,16 @@
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;

import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class BlockSyntax {
private static ParserContext BLOCK_CONTEXT = new ParserContext();

private static Set<String> knownBadLines = new HashSet<>();

static {
BLOCK_CONTEXT.setPreferringWildcard(true);
BLOCK_CONTEXT.setRestricted(false);
@@ -44,7 +48,7 @@ public static BaseBlock getBlock(String line) {
}

public static BaseBlock getBlock(String line, boolean wild) {
if (line == null || line.trim().isEmpty()) {
if (line == null || line.trim().isEmpty() || knownBadLines.contains(line)) {
return null;
}

@@ -71,6 +75,7 @@ public static BaseBlock getBlock(String line, boolean wild) {
}
if (material == null) {
CraftBookPlugin.logger().warning("Invalid block format: " + line);
knownBadLines.add(line);
}
}
return blockState;

0 comments on commit 8423ef5

Please sign in to comment.
You can’t perform that action at this time.