summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandtppos.java
blob: f352da37d1ca3cb3af76dbb3c100f77945e2caf7 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 Commandtppos extends EssentialsCommand
{
	public Commandtppos()
	{
		super("tppos");
	}

	@Override
	public String[] getTriggers()
	{
		return new String[]
				{
					getName(), "tpp"
				};
	}

	@Override
	public void run(Server server, Essentials parent, User user, String commandLabel, String[] args) throws Exception
	{
		if (args.length < 3)
		{
			user.sendMessage("§cUsage: /tppos [x] [y] [z]");
			return;
		}
		int x = Integer.parseInt(args[0]);
		int y = Integer.parseInt(args[1]);
		int z = Integer.parseInt(args[2]);
		Location l = new Location(user.getWorld(),x,y,z);
		user.canAfford(this);
		user.teleportCooldown();
		user.sendMessage("§7Teleporting...");
		user.teleportTo(user.getSafeDestination(l), this.getName());
	}
}