mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
Changed CustomPlayerFishEvent
This commit is contained in:
parent
05a6d46a0d
commit
bd479df373
@ -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;
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user