Paper/Remapped-Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch
2021-06-11 13:56:17 +02:00

20 Zeilen
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 23:48:39 -0400
Subject: [PATCH] Auto fix bad Y levels on player login
Bring down to a saner Y level if super high, as this can cause the server to crash
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index bd3d9182dfb2c0ae1d8c3b9aa360f94c33252592..3a2356b3e00098d100a179a05316f402390d4e9b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -337,6 +337,7 @@ public class ServerPlayer extends Player implements ContainerListener {
@Override
public void readAdditionalSaveData(CompoundTag tag) {
super.readAdditionalSaveData(tag);
+ if (this.getY() > 300) this.setPosRaw(getX(), 257, getZ()); // Paper - bring down to a saner Y level if out of world
if (tag.contains("playerGameType", 99)) {
if (this.getServer().getForceGameType()) {
this.gameMode.setGameModeForPlayer(this.getServer().getDefaultGameType(), GameType.NOT_SET);