Formatting
This commit is contained in:
@@ -45,14 +45,20 @@ public final class ItemUtils {
|
||||
}
|
||||
|
||||
public static boolean isEggItem(ItemStack item) {
|
||||
if (item == null) return false;
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta == null) return false;
|
||||
if (meta == null) {
|
||||
return false;
|
||||
}
|
||||
return meta.getPersistentDataContainer().has(Keys.EGG_ITEM, PersistentDataType.STRING);
|
||||
}
|
||||
|
||||
public static EggType getEggType(ItemStack item) {
|
||||
if (!isEggItem(item)) return null;
|
||||
if (!isEggItem(item)) {
|
||||
return null;
|
||||
}
|
||||
String name = item.getItemMeta().getPersistentDataContainer().get(Keys.EGG_ITEM, PersistentDataType.STRING);
|
||||
try {
|
||||
return name == null ? null : EggType.valueOf(name);
|
||||
@@ -65,11 +71,14 @@ public final class ItemUtils {
|
||||
String[] parts = name.toLowerCase().split("_");
|
||||
List<String> out = new ArrayList<>();
|
||||
for (String p : parts) {
|
||||
if (p.isEmpty()) continue;
|
||||
if (p.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
out.add(Character.toUpperCase(p.charAt(0)) + p.substring(1));
|
||||
}
|
||||
return String.join(" ", out);
|
||||
}
|
||||
|
||||
private ItemUtils() {}
|
||||
private ItemUtils() {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user