9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-31 04:46:36 +00:00

checkpoint - 23

This commit is contained in:
XiaoMoMi
2024-07-04 02:43:51 +08:00
parent 274055dfce
commit f6c0058890
13 changed files with 348 additions and 109 deletions

View File

@@ -24,10 +24,13 @@ import net.momirealms.customfishing.common.plugin.scheduler.SchedulerTask;
import net.momirealms.customfishing.common.util.TriConsumer;
import net.momirealms.customfishing.common.util.TriFunction;
import net.momirealms.sparrow.heart.SparrowHeart;
import net.momirealms.sparrow.heart.feature.inventory.HandSlot;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.entity.FishHook;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -196,6 +199,7 @@ public class CustomFishingHook {
SparrowHeart.getInstance().swingHand(context.getHolder(), gears.getRodSlot());
end();
scheduleNextFishing();
return;
}
if (nextLoot.instantGame()) {
@@ -203,7 +207,16 @@ public class CustomFishingHook {
}
private void scheduleNextFishing() {
final Player player = context.getHolder();
plugin.getScheduler().sync().runLater(() -> {
if (player.isOnline()) {
ItemStack item = player.getInventory().getItem(gears.getRodSlot() == HandSlot.MAIN ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND);
if (item.getType() == Material.FISHING_ROD) {
SparrowHeart.getInstance().useItem(player, gears.getRodSlot(), item);
SparrowHeart.getInstance().swingHand(context.getHolder(), gears.getRodSlot());
}
}
}, 20, player.getLocation());
}
public void onLand() {