Archiviert
13
0

Added reset for pitch/yaw if they are somehow set to NaN.

Dieser Commit ist enthalten in:
EvilSeph 2011-04-23 04:18:00 -04:00
Ursprung 2ad7856d78
Commit 5dfe732f18

Datei anzeigen

@ -147,7 +147,12 @@ public abstract class Entity {
protected void c(float f, float f1) { protected void c(float f, float f1) {
// Craftbukkit start // Craftbukkit start
if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY) || (Float.isNaN(f))) { if (Float.isNaN(f)) {
// CraftBukkit - yaw was sometimes set to NaN, so we need to set it back to 0.
f = 0;
}
if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY)) {
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw"); System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
@ -155,7 +160,12 @@ public abstract class Entity {
f = 0; f = 0;
} }
if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY) || (Float.isNaN(f1))) { if (Float.isNaN(f1)) {
// CraftBukkit - pitch was sometimes set to NaN, so we need to set it back to 0.
f1 = 0;
}
if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY)) {
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch"); System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope"); ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");