9
0
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:
Boy
2023-02-03 19:14:53 +01:00
parent c7730429de
commit 4aa1f9451d
2 changed files with 7 additions and 4 deletions

View File

@@ -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);
}
}

View File

@@ -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();
}
}