9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2026-01-04 15:41:46 +00:00

improve logs

This commit is contained in:
XiaoMoMi
2025-01-06 15:44:25 +08:00
parent 72759b7442
commit 559895897a
3 changed files with 12 additions and 7 deletions

View File

@@ -361,12 +361,17 @@ public class BukkitItemManager extends AbstractItemManager {
try {
return new ItemStack(Material.valueOf(id.toUpperCase(Locale.ENGLISH)));
} catch (IllegalArgumentException e) {
Material material = Registry.MATERIAL.get(new NamespacedKey("minecraft", id.toLowerCase(Locale.ENGLISH)));
if (material != null) {
return new ItemStack(material);
try {
Material material = Registry.MATERIAL.get(new NamespacedKey("minecraft", id.toLowerCase(Locale.ENGLISH)));
if (material != null) {
return new ItemStack(material);
}
plugin.getPluginLogger().warn("Item " + id + " not exists", e);
return new ItemStack(Material.PAPER);
} catch (IllegalArgumentException exception) {
plugin.getPluginLogger().warn("Illegal item " + id, exception);
return new ItemStack(Material.PAPER);
}
plugin.getPluginLogger().warn("Item " + id + " not exists", e);
return new ItemStack(Material.PAPER);
}
} else {
String[] split = id.split(":", 2);