[#2069] Fix for modded items being added to cardboardbox blacklist

This commit is contained in:
Brian Lewis 2015-02-18 16:31:05 -06:00
parent dcf7d7772a
commit e842556c5b

View file

@ -60,20 +60,21 @@ public final class BoxBlacklistParser
{ {
line++; line++;
if(readingLine.startsWith("#")) if(readingLine.startsWith("#") || readingLine.trim().isEmpty())
{ {
continue; continue;
} }
String[] split = readingLine.split(":"); String[] split = readingLine.split(":");
if(split.length != 2 || !isInteger(split[1])) if(split.length < 2 || split.length > 3 || !isInteger(split[split.length - 1]))
{ {
Mekanism.logger.error("BoxBlacklist.txt: Couldn't parse blacklist data on line " + line); Mekanism.logger.error("BoxBlacklist.txt: Couldn't parse blacklist data on line " + line);
continue; continue;
} }
String blockName = (split.length == 2) ? split[0].trim() : split[0].trim() + ":" + split[1].trim();
Block block = Block.getBlockFromName(split[0].trim()); Block block = Block.getBlockFromName(blockName);
if(block == null) if(block == null)
{ {
@ -81,7 +82,7 @@ public final class BoxBlacklistParser
continue; continue;
} }
MekanismAPI.addBoxBlacklist(block, Integer.parseInt(split[1])); MekanismAPI.addBoxBlacklist(block, Integer.parseInt(split[split.length - 1]));
entries++; entries++;
} }