Skip to content

Commit

Permalink
fixed some console spam
Browse files Browse the repository at this point in the history
  • Loading branch information
dries007 committed Mar 20, 2016
1 parent ac96d5c commit f428f7c
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -40,7 +40,7 @@ public static void init()
for (String item : addList)
{
List<Block> blocks = matchBlock(item);
if (blocks.isEmpty()) D3Core.getLogger().warn("[EndermanGriefing] '{}' does not match any block...", item);
if (blocks.isEmpty()) D3Core.getLogger().warn("[EndermanGriefing] '{}' does not match any block...", item);
else
{
for (Block block : blocks)
Expand Down Expand Up @@ -71,17 +71,19 @@ public static void init()

private static List<Block> matchBlock(String item)
{
boolean ignored = false;
ArrayList<Block> blocks = new ArrayList<>();
Pattern pattern = Pattern.compile(item.replace("*", ".*?"));
FMLControlledNamespacedRegistry<Block> blockData = GameData.getBlockRegistry();
for (Block block : blockData.typeSafeIterable())
{
if (pattern.matcher(blockData.getNameForObject(block)).matches())
{
if (blockData.getId(block) > 255) D3Core.getLogger().warn("[EndermanGriefing] Blocks with ID > 255 won't work! Not accepting {}", blockData.getNameForObject(block));
if (blockData.getId(block) > 255) ignored = true;
else blocks.add(block);
}
}
if (ignored) D3Core.getLogger().warn("[EndermanGriefing] Blocks with ID > 255 won't work! Some blocks matching {} have been ignored.", item);
return blocks;
}

Expand Down

0 comments on commit f428f7c

Please sign in to comment.