Adds velocity check util
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.willfp.ecoenchants.enchantments.util;
|
||||
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class VelocityChecks {
|
||||
/**
|
||||
* Checks to see if the velocity is unsafe. This is taken from Papers 0054-Add-velocity-warnings.patch
|
||||
* @param vel
|
||||
* @return
|
||||
*/
|
||||
public static boolean isUnsafeVelocity(Vector vel) {
|
||||
final double x = vel.getX();
|
||||
final double y = vel.getY();
|
||||
final double z = vel.getZ();
|
||||
|
||||
if (x > 4 || x < -4 || y > 4 || y < -4 || z > 4 || z < -4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user