Update ItemUtil.java

This commit is contained in:
Aleksey 2020-12-27 16:04:36 +03:00
parent 67340033bc
commit a0f7a2878d

View file

@ -29,7 +29,10 @@ public class ItemUtil {
@Nullable
public static ItemStack fromStackString(String stackString) {
if (stackString == null || stackString.equals("")) return null;
if (stackString == null || stackString.equals("")) {
return null;
}
try {
String[] parts = stackString.split(":");
if (parts.length < 2) return null;
if (parts.length == 2) {
@ -42,6 +45,10 @@ public class ItemUtil {
Item item = Registry.ITEM.getOrEmpty(itemId).orElse(null);
if (item == null) return null;
return new ItemStack(item, Integer.valueOf(parts[2]));
} catch (Exception ex) {
BetterEnd.LOGGER.catching(ex);
}
return null;
}
@Nullable