Make it better

This commit is contained in:
Rosenthalk0 2023-05-14 11:38:20 -05:00
parent 4efea5a495
commit 79cbf15267

View File

@ -2,7 +2,6 @@ package net.Indyuce.mmoitems.listener;
import io.lumine.mythic.lib.api.crafting.event.MythicCraftItemEvent; import io.lumine.mythic.lib.api.crafting.event.MythicCraftItemEvent;
import io.lumine.mythic.lib.api.item.NBTItem; import io.lumine.mythic.lib.api.item.NBTItem;
import net.Indyuce.mmoitems.MMOItems;
import net.Indyuce.mmoitems.api.event.CraftMMOItemEvent; import net.Indyuce.mmoitems.api.event.CraftMMOItemEvent;
import net.Indyuce.mmoitems.api.player.PlayerData; import net.Indyuce.mmoitems.api.player.PlayerData;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -23,19 +22,19 @@ public class CraftingListener implements Listener {
result = firstResult; result = firstResult;
} }
if (result == null){ if (result == null){
MMOItems.log("No Result Item!"); return;
}
if (!NBTItem.get(result).hasType()){
return; return;
} }
if (NBTItem.get(result).hasType()){ CraftMMOItemEvent e = new CraftMMOItemEvent(PlayerData.get(((Player) event.getTrigger().getWhoClicked())), result);
CraftMMOItemEvent e = new CraftMMOItemEvent(PlayerData.get(((Player) event.getTrigger().getWhoClicked())), result); Bukkit.getPluginManager().callEvent(e);
Bukkit.getPluginManager().callEvent(e);
event.setCancelled(e.isCancelled());
event.setCancelled(e.isCancelled());
return;
}
} }
// @EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true) // @EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true)