mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-29 11:59:11 +00:00
1.2.17.1
This commit is contained in:
@@ -32,14 +32,16 @@ public class FishResultEvent extends PlayerEvent implements Cancellable {
|
||||
private boolean isDouble;
|
||||
private final FishResult result;
|
||||
private final ItemStack loot;
|
||||
private final String loot_id;
|
||||
private static final HandlerList handlerList = new HandlerList();
|
||||
|
||||
public FishResultEvent(@NotNull Player who, FishResult result, boolean isDouble, ItemStack loot) {
|
||||
public FishResultEvent(@NotNull Player who, FishResult result, boolean isDouble, @Nullable ItemStack loot, @Nullable String loot_id) {
|
||||
super(who);
|
||||
this.cancelled = false;
|
||||
this.result = result;
|
||||
this.isDouble = isDouble;
|
||||
this.loot = loot;
|
||||
this.loot_id = loot_id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,4 +81,9 @@ public class FishResultEvent extends PlayerEvent implements Cancellable {
|
||||
public void setDouble(boolean willDouble) {
|
||||
isDouble = willDouble;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getLoot_id() {
|
||||
return loot_id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customfishing.integration.quest;
|
||||
|
||||
import io.github.battlepass.BattlePlugin;
|
||||
import io.github.battlepass.objects.quests.variable.QuestResult;
|
||||
import io.github.battlepass.quests.quests.external.executor.ExternalQuestExecutor;
|
||||
import io.github.battlepass.registry.quest.QuestRegistry;
|
||||
import net.momirealms.customfishing.CustomFishing;
|
||||
import net.momirealms.customfishing.api.event.FishResultEvent;
|
||||
import net.momirealms.customfishing.object.fishing.FishResult;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class BattlePassCFQuest extends ExternalQuestExecutor implements Listener {
|
||||
|
||||
public static void register() {
|
||||
QuestRegistry questRegistry = BattlePlugin.getApi().getQuestRegistry();
|
||||
questRegistry.hook("customfishing", instance -> {
|
||||
BattlePassCFQuest battlePassCFQuest = new BattlePassCFQuest(instance);
|
||||
return battlePassCFQuest;
|
||||
});
|
||||
}
|
||||
|
||||
public BattlePassCFQuest(BattlePlugin battlePlugin) {
|
||||
super(battlePlugin, "customfishing");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onFishCaught(FishResultEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
Player player = event.getPlayer();
|
||||
if (event.getResult() == FishResult.CAUGHT_LOOT || event.getResult() == FishResult.CAUGHT_VANILLA || event.getResult() == FishResult.CAUGHT_MOB) {
|
||||
this.execute("fish", player, (var1x) -> var1x.root(event.getLoot_id()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customfishing.integration.quest;
|
||||
|
||||
public class BetonQuestHook {
|
||||
}
|
||||
@@ -1,3 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) <2022> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customfishing.integration.quest;
|
||||
|
||||
import com.electro2560.dev.cluescrolls.api.ClueScrollsAPI;
|
||||
@@ -22,6 +39,7 @@ public class ClueScrollHook implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onFish(FishResultEvent event) {
|
||||
if (event.isCancelled()) return;
|
||||
if (event.getResult() == FishResult.CAUGHT_LOOT || event.getResult() == FishResult.CAUGHT_VANILLA) {
|
||||
fishClue.handle(event.getPlayer(), 1);
|
||||
commonClue.handle(event.getPlayer(), 1);
|
||||
|
||||
@@ -498,7 +498,7 @@ public class FishingManager extends Function {
|
||||
|
||||
private void dropCustomFishingLoot(Player player, Location location, DroppedItem droppedItem, boolean isDouble, double scoreMultiplier) {
|
||||
ItemStack drop = getCustomFishingLootItemStack(droppedItem, player);
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_LOOT, isDouble, drop);
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_LOOT, isDouble, drop, droppedItem.getKey());
|
||||
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
||||
if (fishResultEvent.isCancelled()) {
|
||||
return;
|
||||
@@ -539,7 +539,7 @@ public class FishingManager extends Function {
|
||||
ItemStack itemStack = McMMOTreasure.getTreasure(player);
|
||||
if (itemStack == null) return false;
|
||||
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_VANILLA, isDouble, itemStack);
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_VANILLA, isDouble, itemStack, "mcmmo");
|
||||
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
||||
if (fishResultEvent.isCancelled()) {
|
||||
return true;
|
||||
@@ -582,7 +582,7 @@ public class FishingManager extends Function {
|
||||
}
|
||||
}
|
||||
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_VANILLA, isDouble, itemStack);
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_VANILLA, isDouble, itemStack, "vanilla");
|
||||
Bukkit.getPluginManager().callEvent(fishResultEvent);
|
||||
if (fishResultEvent.isCancelled()) {
|
||||
return;
|
||||
@@ -605,7 +605,7 @@ public class FishingManager extends Function {
|
||||
MobInterface mobInterface = CustomFishing.plugin.getIntegrationManager().getMobInterface();
|
||||
if (mobInterface == null) return;
|
||||
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_MOB, false, null);
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.CAUGHT_MOB, false, null, loot.getKey());
|
||||
if (fishResultEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
@@ -695,7 +695,7 @@ public class FishingManager extends Function {
|
||||
|
||||
private void fail(Player player, Loot loot, boolean isVanilla) {
|
||||
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.FAILURE, false, null);
|
||||
FishResultEvent fishResultEvent = new FishResultEvent(player, FishResult.FAILURE, false, null, "null");
|
||||
Bukkit.getServer().getPluginManager().callEvent(fishResultEvent);
|
||||
if (fishResultEvent.isCancelled()) {
|
||||
return;
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.momirealms.customfishing.integration.block.VanillaBlockImpl;
|
||||
import net.momirealms.customfishing.integration.item.*;
|
||||
import net.momirealms.customfishing.integration.mob.MythicMobsMobImpl;
|
||||
import net.momirealms.customfishing.integration.papi.PlaceholderManager;
|
||||
import net.momirealms.customfishing.integration.quest.BattlePassCFQuest;
|
||||
import net.momirealms.customfishing.integration.quest.ClueScrollHook;
|
||||
import net.momirealms.customfishing.integration.season.CustomCropsSeasonImpl;
|
||||
import net.momirealms.customfishing.integration.season.RealisticSeasonsImpl;
|
||||
@@ -216,6 +217,14 @@ public class IntegrationManager extends Function {
|
||||
Bukkit.getPluginManager().registerEvents(clueScrollHook, CustomFishing.plugin);
|
||||
hookMessage("ClueScrolls");
|
||||
}
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("BetonQuest")) {
|
||||
|
||||
hookMessage("BetonQuest");
|
||||
}
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("BattlePass")) {
|
||||
BattlePassCFQuest.register();
|
||||
hookMessage("BattlePass");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user