Fix for single chance parsing

This commit is contained in:
Jesse Boyd 2019-11-11 19:47:26 +00:00
parent 55d6217c32
commit 7d7414ebb9
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -104,6 +104,15 @@ public final class BlockBucket implements ConfigurationSerializable {
String[] blocksStr = string.split(",(?![^\\(\\[]*[\\]\\)])");
if (blocksStr.length == 1) {
try {
Matcher matcher = regex.matcher(string);
if (matcher.find()) {
String chanceStr = matcher.group("chance");
String block = matcher.group("block");
if (chanceStr != null && block != null && !MathMan.isInteger(block) && MathMan.isInteger(chanceStr)) {
String namespace = matcher.group("namespace");
string = (namespace == null ? "" : namespace + ":") + block;
}
}
this.single = BlockUtil.get(string);
this.pattern = new BlockPattern(single);
return;