Commits

md_5 authored 33d5de312e9
SPIGOT-602: Kick players with non-finite locations
No tags

nms-patches/PlayerConnection.patch

Modified
1 ---- ../work/decompile-8eb82bde/net/minecraft/server/PlayerConnection.java 2015-02-20 15:17:19.419840293 +1100
2 -+++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-02-20 15:17:19.423840297 +1100
1 +--- ../work/decompile-8eb82bde/net/minecraft/server/PlayerConnection.java 2015-02-26 21:28:11.874168704 +1100
2 ++++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-02-26 21:28:11.878168702 +1100
3 3 @@ -16,6 +16,48 @@
4 4 import org.apache.logging.log4j.LogManager;
5 5 import org.apache.logging.log4j.Logger;
6 6
7 7 +// CraftBukkit start
8 8 +import java.util.concurrent.ExecutionException;
9 9 +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
10 10 +import java.util.HashSet;
11 11 +
12 12 +import org.bukkit.craftbukkit.entity.CraftPlayer;
144 144 - Futures.getUnchecked(this.minecraftServer.postToMainThread(new PlayerConnectionDisconnector(this)));
145 145 + this.minecraftServer.postToMainThread(new PlayerConnectionDisconnector(this)); // CraftBukkit - Don't wait
146 146 }
147 147
148 148 public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) {
149 149 @@ -90,6 +182,13 @@
150 150
151 151 public void a(PacketPlayInFlying packetplayinflying) {
152 152 PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.u());
153 153 + // CraftBukkit start - Check for NaN
154 -+ if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) || Double.isNaN(packetplayinflying.z)) {
154 ++ if (!NumberConversions.isFinite(packetplayinflying.x) || !NumberConversions.isFinite(packetplayinflying.y) || !NumberConversions.isFinite(packetplayinflying.z)) {
155 155 + c.warn(player.getName() + " was caught trying to crash the server with an invalid position.");
156 156 + getPlayer().kickPlayer("Nope!");
157 157 + return;
158 158 + }
159 159 + // CraftBukkit end
160 160 WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
161 161
162 162 this.h = true;
163 163 @@ -108,8 +207,65 @@
164 164 this.checkMovement = true;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut