summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandtop.java
blob: 7776e7bcb2787e49103b3b1d1b9526c06d4979ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.earth2me.essentials.commands;

import org.bukkit.Location;
import org.bukkit.Server;
import com.earth2me.essentials.Essentials;
import com.earth2me.essentials.User;


public class Commandtop extends EssentialsCommand
{
	public Commandtop()
	{
		super("top");
	}

	@Override
	public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception
	{
		int topX = user.getLocation().getBlockX();
		int topZ = user.getLocation().getBlockZ();
		int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
		user.charge(this);
		user.teleportTo(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), this.getName());
		user.sendMessage("§7Teleporting to top.");
	}
}