3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-03 14:50:19 +01:00

Ensure that the player never dimension switches to the same dimension

Fixes #2342
Dieser Commit ist enthalten in:
Camotoy 2021-07-01 08:48:22 -04:00
Ursprung b757032457
Commit 7ae27c79e8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -83,8 +83,11 @@ public class JavaRespawnTranslator extends PacketTranslator<ServerRespawnPacket>
String newDimension = DimensionUtils.getNewDimension(packet.getDimension()); String newDimension = DimensionUtils.getNewDimension(packet.getDimension());
if (!session.getDimension().equals(newDimension) || !packet.getWorldName().equals(session.getWorldName())) { if (!session.getDimension().equals(newDimension) || !packet.getWorldName().equals(session.getWorldName())) {
if (!packet.getWorldName().equals(session.getWorldName()) && session.getDimension().equals(newDimension)) { // Switching to a new world (based off the world name change); send a fake dimension change
// Switching to a new world (based off the world name change); send a fake dimension change if (!packet.getWorldName().equals(session.getWorldName()) && (session.getDimension().equals(newDimension)
// Ensure that the player never ever dimension switches to the same dimension - BAD
// Can likely be removed if the Above Bedrock Nether Building option can be removed
|| DimensionUtils.javaToBedrock(session.getDimension()) == DimensionUtils.javaToBedrock(newDimension))) {
String fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), newDimension); String fakeDim = DimensionUtils.getTemporaryDimension(session.getDimension(), newDimension);
DimensionUtils.switchDimension(session, fakeDim); DimensionUtils.switchDimension(session, fakeDim);
} }