blob: 043f2317295b8ca6671f8119ce00e26209f1a4f1 (
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
43
44
45
46
47
48
|
package com.earth2me.essentials.commands;
import com.earth2me.essentials.Trade;
import org.bukkit.Server;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class Commandtpaccept extends EssentialsCommand
{
public Commandtpaccept()
{
super("tpaccept");
}
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
User p = user.getTeleportRequest();
if (p == null)
{
throw new Exception(Util.i18n("noPendingRequest"));
}
Trade charge = new Trade(this.getName(), ess);
if (user.isTeleportRequestHere())
{
charge.isAffordableFor(user);
}
else
{
charge.isAffordableFor(p);
}
user.sendMessage(Util.i18n("requestAccepted"));
p.sendMessage(Util.format("requestAcceptedFrom", user.getDisplayName()));
if (user.isTeleportRequestHere())
{
user.getTeleport().teleport(p, charge);
}
else
{
p.getTeleport().teleport(user, charge);
}
user.requestTeleport(null, false);
}
}
|