2015-11-15 23:32:04 +00:00
|
|
|
package me.totalfreedom.totalfreedommod;
|
|
|
|
|
|
|
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.EventPriority;
|
|
|
|
import org.bukkit.event.player.PlayerMoveEvent;
|
|
|
|
import org.bukkit.util.Vector;
|
|
|
|
|
2016-03-01 16:47:01 +00:00
|
|
|
public class Orbiter 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 player = event.getPlayer();
|
|
|
|
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
|
|
|
|
|
|
|
if (!fPlayer.isOrbiting())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (player.getVelocity().length() < fPlayer.orbitStrength() * (2.0 / 3.0))
|
|
|
|
{
|
|
|
|
player.setVelocity(new Vector(0, fPlayer.orbitStrength(), 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|