blob: 86851084c4007b7619abc4904566a3a5b5579c81 (
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
|
package net.nemez.chatapi.click;
import java.util.UUID;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.nemez.chatapi.ChatAPI;
public class CallbackCommand extends Command {
public CallbackCommand(String internalCommandName) {
super(internalCommandName);
}
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
if (!(sender instanceof Player)) {
ChatAPI.send(sender, ChatAPI.MESSAGE_PLAYER_CLICK_CALLBACK);
return true;
}
if ((args.length == 1 && args[0].equals("help")) || args.length != 1) {
ChatAPI.send(sender, ChatAPI.MESSAGE_HELP_CLICK_CALLBACK);
return true;
}
int id;
try {
id = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
ChatAPI.send(sender, ChatAPI.MESSAGE_HELP_CLICK_CALLBACK);
return true;
}
UUID uuid = ((Player) sender).getUniqueId();
CallbackMap.execute(sender, uuid, id);
return true;
}
}
|