mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
parent
401ca5d1e0
commit
21591b3dbd
1 changed files with 50 additions and 0 deletions
50
Spigot-Server-Patches/Add-velocity-warnings.patch
Normal file
50
Spigot-Server-Patches/Add-velocity-warnings.patch
Normal file
|
@ -0,0 +1,50 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Hirschfeld <joe@ibj.io>
|
||||
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);
|
||||
+ }
|
||||
}
|
||||
--
|
Loading…
Reference in a new issue