9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-30 04:19:30 +00:00
This commit is contained in:
XiaoMoMi
2023-11-12 20:44:21 +08:00
parent 3b0d3b9147
commit 0c0a0d8f2b
6 changed files with 33 additions and 43 deletions

View File

@@ -17,6 +17,7 @@
package net.momirealms.customfishing.api.event;
import net.momirealms.customfishing.api.mechanic.effect.Effect;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
@@ -31,18 +32,21 @@ public class FishHookLandEvent extends PlayerEvent {
private static final HandlerList handlerList = new HandlerList();
private final Target target;
private final FishHook fishHook;
private final Effect effect;
/**
* Constructs a new FishHookLandEvent.
*
* @param who The player who triggered the event.
* @param target The target where the fishing hook has landed (LAVA or WATER).
* @param hook The fishing hook entity.
* @param who The player who triggered the event.
* @param target The target where the fishing hook has landed (LAVA or WATER).
* @param hook The fishing hook entity.
* @param initialEffect The initial effect
*/
public FishHookLandEvent(@NotNull Player who, Target target, FishHook hook) {
public FishHookLandEvent(@NotNull Player who, Target target, FishHook hook, Effect initialEffect) {
super(who);
this.target = target;
this.fishHook = hook;
this.effect = initialEffect;
}
/**
@@ -67,6 +71,15 @@ public class FishHookLandEvent extends PlayerEvent {
return handlerList;
}
/**
* Get the fishing effect
*
* @return fishing effect
*/
public Effect getEffect() {
return effect;
}
@NotNull
@Override
public HandlerList getHandlers() {

View File

@@ -91,8 +91,7 @@ public class FishingPreparation extends Condition {
this.insertArg("{in-bag}", "true");
for (int i = 0; i < fishingBag.getSize(); i++) {
ItemStack itemInBag = fishingBag.getItem(i);
String bagItemID = plugin.getItemManager().getCustomFishingItemID(itemInBag);
if (bagItemID == null) continue;
String bagItemID = plugin.getItemManager().getAnyPluginItemID(itemInBag);
if (!hasBait) {
EffectCarrier effect = plugin.getEffectManager().getEffectCarrier("bait", bagItemID);
if (effect != null) {