Skip to content

Commit

Permalink
add McMMOPlayerMasterAnglerEvent and ability to cancel it if desired (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bobcat4848 authored Nov 16, 2024
1 parent 79ad86f commit 570cadb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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;
Expand Down Expand Up @@ -253,6 +254,13 @@ public void masterAngler(@NotNull FishHook hook, int lureLevel) {
* @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) {
Expand Down

0 comments on commit 570cadb

Please sign in to comment.