testserver/Spigot-Server-Patches/0071-Add-velocity-warnings....

27 lines
1.2 KiB
Diff
Raw Normal View History

2016-04-02 02:08:40 +00:00
From c7a94ca8f1a2da4eebdd69ccc8aa5112605e0d21 Mon Sep 17 00:00:00 2001
2016-02-29 23:09:49 +00:00
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
2016-04-02 02:08:40 +00:00
index f61f6cd..e8a5fdf 100644
2016-02-29 23:09:49 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
2016-03-25 01:23:23 +00:00
@@ -204,6 +204,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
2016-02-29 23:09:49 +00:00
}
public void setVelocity(Vector vel) {
+ // Paper start - Warn server owners when plugins try to set super high velocities
+ if (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();
--
2016-03-31 00:50:23 +00:00
2.8.0
2016-02-29 23:09:49 +00:00