diff --git a/Spigot-Server-Patches/Add-velocity-warnings.patch b/Spigot-Server-Patches/Add-velocity-warnings.patch new file mode 100644 index 0000000000..eeff9397dc --- /dev/null +++ b/Spigot-Server-Patches/Add-velocity-warnings.patch @@ -0,0 +1,50 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Joseph Hirschfeld +Date: Mon, 22 Feb 2016 16:05:32 -0500 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -0,0 +0,0 @@ import org.bukkit.permissions.PermissionAttachmentInfo; + import org.bukkit.permissions.ServerOperator; + import org.bukkit.plugin.Plugin; + import org.bukkit.util.Vector; ++import org.github.paperspigot.PaperSpigotConfig; + + public abstract class CraftEntity implements org.bukkit.entity.Entity { + private static final PermissibleBase perm = new PermissibleBase(new ServerOperator() { +@@ -0,0 +0,0 @@ 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 (PaperSpigotConfig.warnForExcessiveVelocity) { ++ 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(); +diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java ++++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java +@@ -0,0 +0,0 @@ public class PaperSpigotConfig + e.printStackTrace(); + } + } ++ ++ public static boolean warnForExcessiveVelocity; ++ private static void excessiveVelocityWarning() ++ { ++ warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); ++ } + } +-- \ No newline at end of file