public class PlayerMoveListener implements Listener { @EventHandler public void onMove(PlayerMoveEvent e) { if (e.isCancelled()) { return; } Player p = e.getPlayer(); Combat c = CombatManager.getCombat(p); if (c.hasFight()) { Location to = e.getTo(); Location from = e.getFrom(); if (((from.getBlockX() != to.getBlockX()) || (from.getBlockY() != to.getBlockY()) || (from.getBlockZ() != to.getBlockZ())) && (ChatUtil.Location(Config.SPAWNLINE_MINX, Config.SPAWNLINE_MAXX, Config.SPAWNLINE_MINZ, Config.SPAWNLINE_MAXZ, to))) { Location l = p.getLocation().subtract(10, 80, 10); double distance = p.getLocation().distance(l); Vector v = l.toVector().add(new Vector(1, 1, 1)).multiply(3.0D / distance); p.setVelocity(v.multiply(4.5D).setY(0.5)); ChatUtil.sendTitleMessage(p, Config.MESSAGES_TITLE, Config.SPAWNLINE_MESSAGE, 75, 70, 65); e.setCancelled(true); return; } } } }