2016-11-17 03:23:38 +01:00
|
|
|
From fe5e6dc3ec8448a373edc77718f64fc51654b95d Mon Sep 17 00:00:00 2001
|
2016-03-01 00:09:49 +01: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-11-17 03:23:38 +01:00
|
|
|
index f8aabe2..6d39f6b 100644
|
2016-03-01 00:09:49 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2016-11-17 03:23:38 +01:00
|
|
|
@@ -227,6 +227,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2016-03-01 00:09:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setVelocity(Vector vel) {
|
|
|
|
+ // Paper start - Warn server owners when plugins try to set super high velocities
|
2016-04-17 20:32:19 +02:00
|
|
|
+ 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() + ").");
|
2016-03-01 00:09:49 +01:00
|
|
|
+ Thread.dumpStack();
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
entity.motX = vel.getX();
|
|
|
|
entity.motY = vel.getY();
|
|
|
|
entity.motZ = vel.getZ();
|
|
|
|
--
|
2016-11-17 03:23:38 +01:00
|
|
|
2.10.2
|
2016-03-01 00:09:49 +01:00
|
|
|
|