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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user