Paper/Spigot-Server-Patches/0066-Add-velocity-warnings.patch
Zach Brown b170e8cedb
Update upstream B/CB/S
Remove two features added upstream
2016-08-27 18:41:58 -05:00

27 lines
1.3 KiB
Diff

From e03a75ce7f4d8561cd2ae428ed4b5c4a2d1054cb Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:48:12 -0600
Subject: [PATCH] Add velocity warnings
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 6f6b90b..719dd66 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -205,6 +205,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public void setVelocity(Vector vel) {
+ // Paper start - Warn server owners when plugins try to set super high velocities
+ if (!(this instanceof org.bukkit.entity.Projectile) && (vel.getX() > 4 || vel.getX() < -4 || vel.getY() > 4 || vel.getY() < -4 || vel.getZ() > 4 || vel.getZ() < -4)) {
+ getServer().getLogger().warning("Excessive velocity set detected: tried to set velocity of entity #" + getEntityId() + " to (" + vel.getX() + "," + vel.getY() + "," + vel.getZ() + ").");
+ Thread.dumpStack();
+ }
+ // Paper end
entity.motX = vel.getX();
entity.motY = vel.getY();
entity.motZ = vel.getZ();
--
2.9.2.windows.1