From 86d7e8c1c1f0f0d705226c67d4778409ef1d07e6 Mon Sep 17 00:00:00 2001 From: Jacob Cuomo Date: Wed, 13 Nov 2024 00:06:19 -0500 Subject: [PATCH] add McMMOPlayerMasterAnglerEvent and ability to cancel it if desired --- .../fishing/McMMOPlayerMasterAnglerEvent.java | 14 ++++++++++++++ .../nossr50/skills/fishing/FishingManager.java | 8 ++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/main/java/com/gmail/nossr50/events/skills/fishing/McMMOPlayerMasterAnglerEvent.java diff --git a/src/main/java/com/gmail/nossr50/events/skills/fishing/McMMOPlayerMasterAnglerEvent.java b/src/main/java/com/gmail/nossr50/events/skills/fishing/McMMOPlayerMasterAnglerEvent.java new file mode 100644 index 000000000..c7b77baa6 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/events/skills/fishing/McMMOPlayerMasterAnglerEvent.java @@ -0,0 +1,14 @@ +package com.gmail.nossr50.events.skills.fishing; + +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.jetbrains.annotations.NotNull; + +public class McMMOPlayerMasterAnglerEvent extends McMMOPlayerFishingEvent { + + public McMMOPlayerMasterAnglerEvent(@NotNull McMMOPlayer mcMMOPlayer) { + super(mcMMOPlayer); + } + +} \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java index 3ca634ec6..96cfccaf3 100644 --- a/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java @@ -10,6 +10,7 @@ import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.treasure.*; import com.gmail.nossr50.events.skills.fishing.McMMOPlayerFishingTreasureEvent; +import com.gmail.nossr50.events.skills.fishing.McMMOPlayerMasterAnglerEvent; import com.gmail.nossr50.events.skills.fishing.McMMOPlayerShakeEvent; import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.mcMMO; @@ -253,6 +254,13 @@ public class FishingManager extends SkillManager { * @param fishHook target fish hook */ public void processMasterAngler(@NotNull FishHook fishHook, int lureLevel) { + McMMOPlayerMasterAnglerEvent event = new McMMOPlayerMasterAnglerEvent(mmoPlayer); + mcMMO.p.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + MasterAnglerCompatibilityLayer masterAnglerCompatibilityLayer = (MasterAnglerCompatibilityLayer) mcMMO.getCompatibilityManager().getMasterAnglerCompatibilityLayer(); if (masterAnglerCompatibilityLayer != null) {