Adds velocity check util

This commit is contained in:
LoJoSho
2022-07-16 21:03:28 -05:00
parent e95ed6efc7
commit 6981c78f90

View File

@@ -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;
}
}