mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-24 03:25:25 +01:00
31 lines
912 B
Java
31 lines
912 B
Java
import org.bukkit.Location;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.util.Vector;
|
|
|
|
import com.garbagemule.MobArena.framework.Arena;
|
|
import com.garbagemule.MobArena.waves.MABoss;
|
|
import com.garbagemule.MobArena.waves.ability.*;
|
|
|
|
@AbilityInfo(
|
|
name = "Throw Distant",
|
|
aliases = {"throwdistant"}
|
|
)
|
|
public class ThrowDistant implements Ability
|
|
{
|
|
/**
|
|
* How far away players must be to be affected by the ability.
|
|
*/
|
|
private final int RADIUS = 8;
|
|
|
|
@Override
|
|
public void execute(Arena arena, MABoss boss) {
|
|
Location bLoc = boss.getEntity().getLocation();
|
|
|
|
for (Player p : AbilityUtils.getDistantPlayers(arena, boss.getEntity(), RADIUS)) {
|
|
Location loc = p.getLocation();
|
|
Vector v = new Vector(loc.getX() - bLoc.getX(), 0, loc.getZ() - bLoc.getZ());
|
|
p.setVelocity(v.normalize().setY(0.8));
|
|
}
|
|
}
|
|
}
|