Paper/Spigot-Server-Patches/0118-Auto-fix-bad-Y-levels-...

23 lines
1.1 KiB
Diff

From 7f770d5475c7bf8ae56d1eb2f24e4cdc88a27a46 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/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index ae1f0d5783..a5701623bf 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -197,6 +197,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@Override
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
+ if (this.locY() > 300) this.setPositionRaw(locX(), 257, locZ()); // Paper - bring down to a saner Y level if out of world
if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
if (this.getMinecraftServer().getForceGamemode()) {
this.playerInteractManager.setGameMode(this.getMinecraftServer().getGamemode());
--
2.25.0.windows.1