From cfa1b5d0cd00b6d4bbbdaf168962c0ec394ac689 Mon Sep 17 00:00:00 2001 From: YoyoNow Date: Tue, 25 Nov 2025 18:26:45 +0100 Subject: [PATCH] Hotfix XrayCommand bugging players back --- .../utils/PlayerMovementWrapper21.java | 46 +++++++++++++++++++ .../bausystem/features/xray/XrayCommand.java | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/PlayerMovementWrapper21.java diff --git a/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/PlayerMovementWrapper21.java b/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/PlayerMovementWrapper21.java new file mode 100644 index 00000000..e62e4591 --- /dev/null +++ b/BauSystem/BauSystem_21/src/de/steamwar/bausystem/utils/PlayerMovementWrapper21.java @@ -0,0 +1,46 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2025 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.bausystem.utils; + +import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket; +import net.minecraft.server.level.ServerPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.entity.Player; + +public class PlayerMovementWrapper21 implements PlayerMovementWrapper { + + @Override + public void setPosition(Player player, Object object) { + ServerboundMovePlayerPacket packetPlayInFlying = ((ServerboundMovePlayerPacket) object); + ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle(); + if (packetPlayInFlying.hasPos) { + serverPlayer.setPosRaw(packetPlayInFlying.x, packetPlayInFlying.y, packetPlayInFlying.z); + } + if (packetPlayInFlying.hasRot) { + serverPlayer.setXRot(packetPlayInFlying.xRot); + serverPlayer.setYRot(packetPlayInFlying.yRot); + } + } + + @Override + public Object convertToOut(Player player, Object object) { + return object; + } +} diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java index babd0d88..b128e27a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java @@ -104,7 +104,7 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen if (hidden.containsKey(region) && hidden.get(region).contains(player)) { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { PlayerMovementWrapper.impl.setPosition(player, o); - }, 1L); + }, 0); return null; } return o;