mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-18 05:16:12 +00:00
48 lines
1.1 KiB
Java
48 lines
1.1 KiB
Java
|
package me.totalfreedom.totalfreedommod;
|
||
|
|
||
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||
|
import net.pravian.aero.component.service.AbstractService;
|
||
|
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;
|
||
|
|
||
|
public class Orbiter extends AbstractService<TotalFreedomMod>
|
||
|
{
|
||
|
|
||
|
public Orbiter(TotalFreedomMod plugin)
|
||
|
{
|
||
|
super(plugin);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void onStart()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected void onStop()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
@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));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|