summaryrefslogtreecommitdiffstats
path: root/Essentials/src/com/earth2me/essentials/commands/Commandtpdeny.java
blob: eb266fad5a3c152af408fff336a40d5028e8e394 (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
package com.earth2me.essentials.commands;

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


public class Commandtpdeny extends EssentialsCommand
{
	public Commandtpdeny()
	{
		super("tpdeny");
	}

	@Override
	public void run(Server server, User user, String commandLabel, String[] args) throws Exception
	{
		User p = user.getTeleportRequest();
		if (p == null)
		{
			throw new Exception("You do not have a pending request.");
		}

		if (user.isTeleportRequestHere())
		{
			user.charge(this);
			user.sendMessage("§7Teleport request denied.");
			p.sendMessage("§7Teleport request denied.");
		}
		else
		{
			user.charge(this);
			user.sendMessage("§7Teleport request denied.");
			p.sendMessage("§7Teleport request denied.");
		}
		user.requestTeleport(null, false);
	}
}