9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-30 12:29:19 +00:00

fix teleport packet

This commit is contained in:
XiaoMoMi
2024-11-29 16:10:49 +08:00
parent 1f744e9a4c
commit 17e0806ad9
4 changed files with 7 additions and 5 deletions

View File

@@ -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<CommandSender> {
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);

View File

@@ -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<CommandSender> {
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);