2015-11-15 23:32:04 +00:00
|
|
|
package me.totalfreedom.totalfreedommod;
|
|
|
|
|
|
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
import org.bukkit.event.player.PlayerMoveEvent;
|
|
|
|
|
2016-03-01 16:47:01 +00:00
|
|
|
public class Fuckoff extends FreedomService
|
2015-11-15 23:32:04 +00:00
|
|
|
{
|
|
|
|
@Override
|
2020-07-01 01:51:06 +00:00
|
|
|
public void onStart()
|
2015-11-15 23:32:04 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-07-01 01:51:06 +00:00
|
|
|
public void onStop()
|
2015-11-15 23:32:04 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
@EventHandler(priority = EventPriority.NORMAL)
|
|
|
|
public void onPlayerMove(PlayerMoveEvent event)
|
|
|
|
{
|
|
|
|
final Player fuckoffPlayer = event.getPlayer();
|
|
|
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
|
|
|
{
|
|
|
|
final FPlayer fPlayer = plugin.pl.getPlayer(onlinePlayer);
|
|
|
|
if (!fPlayer.isFuckOff()
|
|
|
|
|| fuckoffPlayer.equals(onlinePlayer))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
double fuckoffRange = fPlayer.getFuckoffRadius();
|
|
|
|
Location opLocation = onlinePlayer.getLocation();
|
|
|
|
Location foLocation = fuckoffPlayer.getLocation();
|
|
|
|
|
|
|
|
double distanceSquared;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
distanceSquared = opLocation.distanceSquared(foLocation);
|
|
|
|
}
|
|
|
|
catch (IllegalArgumentException ex)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (distanceSquared < (fuckoffRange * fuckoffRange))
|
|
|
|
{
|
2020-06-30 09:14:44 +00:00
|
|
|
fuckoffPlayer.setVelocity(onlinePlayer.getLocation().toVector().add(foLocation.toVector()).normalize().multiply(fPlayer.getFuckoffRadius()));
|
2015-11-15 23:32:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-07-28 06:04:16 +00:00
|
|
|
}
|