diff --git a/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java b/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java index c82a65c3..ec385209 100644 --- a/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java +++ b/src/main/java/net/Indyuce/mmocore/api/event/CustomPlayerFishEvent.java @@ -2,27 +2,31 @@ package net.Indyuce.mmocore.api.event; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; +import org.bukkit.inventory.ItemStack; -import net.Indyuce.mmocore.api.droptable.dropitem.DropItem; import net.Indyuce.mmocore.api.player.PlayerData; public class CustomPlayerFishEvent extends PlayerDataEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); - private final DropItem caught; + private ItemStack caught; private boolean cancelled = false; - public CustomPlayerFishEvent(PlayerData player, DropItem caught) { + public CustomPlayerFishEvent(PlayerData player, ItemStack caught) { super(player); - + this.caught = caught; } - public DropItem getCaught() { + public ItemStack getCaught() { return caught; } + public void setCaught(ItemStack caught) { + this.caught = caught; + } + @Override public boolean isCancelled() { return cancelled; diff --git a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java b/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java index 594ea47d..808eeab9 100644 --- a/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java +++ b/src/main/java/net/Indyuce/mmocore/listener/profession/FishingListener.java @@ -156,17 +156,17 @@ public class FishingListener implements Listener { return; } - CustomPlayerFishEvent called = new CustomPlayerFishEvent(playerData, caught.getDropItem()); - Bukkit.getPluginManager().callEvent(called); - if (called.isCancelled()) - return; - ItemStack collect = caught.collect(new LootBuilder(playerData, 0)); if (collect == null) { hook.getWorld().spawnParticle(Particle.SMOKE_NORMAL, location, 24, 0, 0, 0, .08); return; } + CustomPlayerFishEvent called = new CustomPlayerFishEvent(playerData, collect); + Bukkit.getPluginManager().callEvent(called); + if (called.isCancelled()) + return; + // calculate velocity Item item = hook.getWorld().dropItemNaturally(hook.getLocation(), collect); if (MMOCore.plugin.hasHolograms())