mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-30 20:39:13 +00:00
tweak oraxen hook for nullchecks
This commit is contained in:
@@ -2,7 +2,6 @@ package com.hibiscusmc.hmccosmetics.hooks.items;
|
||||
|
||||
import com.mineinabyss.geary.prefabs.PrefabKey;
|
||||
import com.mineinabyss.looty.LootyFactory;
|
||||
import io.th0rgal.oraxen.api.OraxenItems;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -14,7 +13,8 @@ public class LootyHook extends ItemHook implements Listener {
|
||||
|
||||
@Override
|
||||
public ItemStack get(String itemid) {
|
||||
if (PrefabKey.Companion.ofOrNull(itemid) == null) return null;
|
||||
return LootyFactory.INSTANCE.createFromPrefab(PrefabKey.Companion.of(itemid));
|
||||
PrefabKey prefabKey = PrefabKey.Companion.ofOrNull(itemid);
|
||||
if (prefabKey == null) return null;
|
||||
return LootyFactory.INSTANCE.createFromPrefab(prefabKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.hibiscusmc.hmccosmetics.hooks.items;
|
||||
|
||||
import io.th0rgal.oraxen.api.OraxenItems;
|
||||
import io.th0rgal.oraxen.items.ItemBuilder;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -12,6 +13,8 @@ public class OraxenHook extends ItemHook implements Listener {
|
||||
|
||||
@Override
|
||||
public ItemStack get(String itemid) {
|
||||
return OraxenItems.getItemById(itemid).build();
|
||||
ItemBuilder builder = OraxenItems.getItemById(itemid);
|
||||
if (builder == null) return null;
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user