From 17e0806ad9fef56e80a8dd9c07bf8de18fd60313 Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Fri, 29 Nov 2024 16:10:49 +0800 Subject: [PATCH] fix teleport packet --- .../customfishing/api/event/FishingEffectApplyEvent.java | 4 ++-- .../customfishing/bukkit/command/feature/GetItemCommand.java | 3 ++- .../customfishing/bukkit/command/feature/GiveItemCommand.java | 3 ++- gradle.properties | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/net/momirealms/customfishing/api/event/FishingEffectApplyEvent.java b/api/src/main/java/net/momirealms/customfishing/api/event/FishingEffectApplyEvent.java index e3a0a665..a1806dbc 100644 --- a/api/src/main/java/net/momirealms/customfishing/api/event/FishingEffectApplyEvent.java +++ b/api/src/main/java/net/momirealms/customfishing/api/event/FishingEffectApplyEvent.java @@ -47,7 +47,7 @@ public class FishingEffectApplyEvent extends Event { * {@link Stage#LOOT}: The effect at this stage play a crucial role in what loot will appear next, and weighted effects should be applied at this stage. * {@link Stage#FISHING}: The effects at this stage affect the hook time, game difficulty and other fishing-related attributes *

- * For developers, {@link Stage#CAST} will only be triggered once, while the other two stages will be triggered multiple times + * Please note that {@link Stage#CAST} will only be triggered once, while the other two stages might be triggered multiple times * * @return the stage */ @@ -62,7 +62,7 @@ public class FishingEffectApplyEvent extends Event { * Effects at stage {@link Stage#LOOT}/{@link Stage#FISHING} are temporary because the fishhook could move. For example, it flows from the water into the lava or another biome, * causing some conditional effects changing. *

- * For developers, {@link Stage#CAST} will only be triggered once, while the other two stages will be triggered multiple times + * Please note that {@link Stage#CAST} will only be triggered once, while the other two stages might be triggered multiple times * * @return the effect */ diff --git a/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GetItemCommand.java b/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GetItemCommand.java index 8b9b47b5..620cfaeb 100644 --- a/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GetItemCommand.java +++ b/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GetItemCommand.java @@ -25,6 +25,7 @@ import net.momirealms.customfishing.api.util.PlayerUtils; import net.momirealms.customfishing.bukkit.command.BukkitCommandFeature; import net.momirealms.customfishing.common.command.CustomFishingCommandManager; import net.momirealms.customfishing.common.locale.MessageConstants; +import org.bukkit.GameMode; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -77,7 +78,7 @@ public class GetItemCommand extends BukkitCommandFeature { amountToGive -= perStackSize; ItemStack more = itemStack.clone(); more.setAmount(perStackSize); - if (toInv) { + if (toInv || player.getGameMode() == GameMode.SPECTATOR) { PlayerUtils.putItemsToInventory(player.getInventory(), more, more.getAmount()); } else { PlayerUtils.dropItem(player, more, false, true, false); diff --git a/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GiveItemCommand.java b/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GiveItemCommand.java index cc9c688e..0309fec6 100644 --- a/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GiveItemCommand.java +++ b/core/src/main/java/net/momirealms/customfishing/bukkit/command/feature/GiveItemCommand.java @@ -25,6 +25,7 @@ import net.momirealms.customfishing.api.util.PlayerUtils; import net.momirealms.customfishing.bukkit.command.BukkitCommandFeature; import net.momirealms.customfishing.common.command.CustomFishingCommandManager; import net.momirealms.customfishing.common.locale.MessageConstants; +import org.bukkit.GameMode; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -78,7 +79,7 @@ public class GiveItemCommand extends BukkitCommandFeature { amountToGive -= perStackSize; ItemStack more = itemStack.clone(); more.setAmount(perStackSize); - if (toInv) { + if (toInv || player.getGameMode() == GameMode.SPECTATOR) { PlayerUtils.putItemsToInventory(player.getInventory(), more, more.getAmount()); } else { PlayerUtils.dropItem(player, more, false, true, false); diff --git a/gradle.properties b/gradle.properties index ca4229b3..13ccfb58 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,7 +20,7 @@ h2_driver_version=2.3.232 sqlite_driver_version=3.47.0.0 adventure_bundle_version=4.17.0 adventure_platform_version=4.3.4 -sparrow_heart_version=0.46 +sparrow_heart_version=0.47 cloud_core_version=2.0.0 cloud_services_version=2.0.0 cloud_brigadier_version=2.0.0-beta.10