9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-25 09:59:28 +00:00

check if cosmetic is null before getting item of cosmetic

This commit is contained in:
LoJoSho
2023-01-08 21:07:49 -06:00
parent 37da85d705
commit f535849d57

View File

@@ -1,5 +1,6 @@
package com.hibiscusmc.hmccosmetics.hooks.items;
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetics;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@@ -12,7 +13,9 @@ public class HMCCosmeticsHook extends ItemHook implements Listener {
@Override
public ItemStack get(String itemid) {
return Cosmetics.getCosmetic(itemid).getItem();
Cosmetic cosmetic = Cosmetics.getCosmetic(itemid);
if (cosmetic == null) return null;
return cosmetic.getItem();
}
}