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-09-27 23:20:39 +08:00
parent 59fa0286e8
commit 75502b1d91
10 changed files with 82 additions and 18 deletions

View File

@@ -18,6 +18,7 @@
package net.momirealms.customfishing.api.event;
import net.momirealms.customfishing.api.mechanic.loot.Loot;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -36,6 +37,7 @@ public class FishingResultEvent extends PlayerEvent implements Cancellable {
private boolean isCancelled;
private final Result result;
private final Loot loot;
private final FishHook fishHook;
private final Map<String, String> args;
/**
@@ -46,11 +48,12 @@ public class FishingResultEvent extends PlayerEvent implements Cancellable {
* @param loot The loot received from fishing.
* @param args A map of placeholders and their corresponding values.
*/
public FishingResultEvent(@NotNull Player who, Result result, Loot loot, Map<String, String> args) {
public FishingResultEvent(@NotNull Player who, Result result, FishHook fishHook, Loot loot, Map<String, String> args) {
super(who);
this.result = result;
this.loot = loot;
this.args = args;
this.fishHook = fishHook;
}
public static HandlerList getHandlerList() {
@@ -93,6 +96,15 @@ public class FishingResultEvent extends PlayerEvent implements Cancellable {
return result;
}
/**
* Get the fish hook entity.
*
* @return fish hook
*/
public FishHook getFishHook() {
return fishHook;
}
/**
* Gets the loot received from fishing.
*

View File

@@ -37,6 +37,7 @@ public class CFLoot implements Loot {
private boolean instanceGame;
private double score;
private String[] lootGroup;
private String filePath;
public CFLoot(String id, LootType type) {
this.id = id;
@@ -60,6 +61,17 @@ public class CFLoot implements Loot {
this.loot = new CFLoot(id, type);
}
/**
* Set the file path for this loot.
*
* @param path file path
* @return The builder.
*/
public Builder filePath(String path) {
this.loot.filePath = path;
return this;
}
/**
* Set the nickname for this loot.
*
@@ -310,6 +322,14 @@ public class CFLoot implements Loot {
}
}
/**
* Get the file path of the loot registered by CustomFishing
* @return file path
*/
public String getFilePath() {
return filePath;
}
/**
* Get the actions triggered by a specific number of successes.
*