mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Improve distance check
This commit is contained in:
parent
87d7ba19de
commit
42b68011ea
@ -44,8 +44,9 @@ public class MovementValidator extends FreedomService
|
||||
final Player player = event.getPlayer();
|
||||
Location from = event.getFrom();
|
||||
Location to = event.getTo();
|
||||
double distance = from.distanceSquared(to);
|
||||
|
||||
if (to.getX() >= from.getX() + MAX_DISTANCE_TRAVELED || to.getY() >= from.getY() + MAX_DISTANCE_TRAVELED || to.getZ() >= from.getZ() + MAX_DISTANCE_TRAVELED)
|
||||
if (distance >= MAX_DISTANCE_TRAVELED)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
player.kickPlayer(ChatColor.RED + "You were moving too quickly!");
|
||||
|
Loading…
Reference in New Issue
Block a user