ignore excessive vel for Minecarts (Fixes #7515)

This commit is contained in:
Shane Freeder 2022-02-28 15:31:41 +00:00
parent 7f65b0b589
commit 30cb7d0407
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add velocity warnings
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f421e55cc6c629f3718d0c7f4cb7ff287c2b643f..b6e9c6fc7f31b06f77cf108ee0f5548cd530ba5a 100644
index c50fdc09494895eaf6813493bdc6a370089d4240..c77db10a1c33266da8d4578e828ff039d550b292 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -282,6 +282,7 @@ public final class CraftServer implements Server {
@ -17,7 +17,7 @@ index f421e55cc6c629f3718d0c7f4cb7ff287c2b643f..b6e9c6fc7f31b06f77cf108ee0f5548c
static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index fdbcf4989f72e1604a2841f565adfeebf8d45622..4ebd7609ec2bf62586feef4da7605dbb89569567 100644
index fdbcf4989f72e1604a2841f565adfeebf8d45622..1e0b8314ef388763aa43055909e48778f0d421a3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -438,10 +438,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -25,7 +25,7 @@ index fdbcf4989f72e1604a2841f565adfeebf8d45622..4ebd7609ec2bf62586feef4da7605dbb
Preconditions.checkArgument(velocity != null, "velocity");
velocity.checkFinite();
+ // Paper start - Warn server owners when plugins try to set super high velocities
+ if (!(this instanceof org.bukkit.entity.Projectile) && isUnsafeVelocity(velocity)) {
+ if (!(this instanceof org.bukkit.entity.Projectile || this instanceof org.bukkit.entity.Minecart) && isUnsafeVelocity(velocity)) {
+ CraftServer.excessiveVelEx = new Exception("Excessive velocity set detected: tried to set velocity of entity " + entity.getScoreboardName() + " id #" + getEntityId() + " to (" + velocity.getX() + "," + velocity.getY() + "," + velocity.getZ() + ").");
+ }
+ // Paper end