Add TopCommand
This commit is contained in:
parent
1e3648358b
commit
069ee177eb
@ -0,0 +1,39 @@
|
|||||||
|
package mineplex.mapparser.command.teleport;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.mapparser.command.BaseCommand;
|
||||||
|
|
||||||
|
public class TopCommand extends BaseCommand
|
||||||
|
{
|
||||||
|
private TeleportManager _teleportManager;
|
||||||
|
|
||||||
|
public TopCommand(TeleportManager teleportManager)
|
||||||
|
{
|
||||||
|
super(teleportManager.getPlugin(), "top");
|
||||||
|
|
||||||
|
_teleportManager = teleportManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, String alias, String[] args)
|
||||||
|
{
|
||||||
|
Location destination = player.getLocation().clone();
|
||||||
|
|
||||||
|
while (destination.getBlock().getType() != Material.AIR
|
||||||
|
&& destination.add(0, 1, 0).getBlock().getType() != Material.AIR)
|
||||||
|
{
|
||||||
|
if (destination.getY() > 256)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_teleportManager.teleportPlayer(player, destination);
|
||||||
|
message(player, "You have been teleported to Y = " + C.cYellow + destination.getY());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user