-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathSetDestinationCommand.java
More file actions
36 lines (27 loc) · 942 Bytes
/
SetDestinationCommand.java
File metadata and controls
36 lines (27 loc) · 942 Bytes
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
package sh.okx.railswitch;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class SetDestinationCommand implements CommandExecutor {
private final RailSwitch plugin;
public SetDestinationCommand(RailSwitch plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!(sender instanceof Player)) {
return false;
}
Player player = (Player) sender;
if (args.length < 1) {
player.sendMessage(ChatColor.GREEN + "Unset rail destination (use /" + label + " <destination> to set your destination).");
plugin.getDatabase().removePlayerDestination(player);
return true;
}
String dest = args[0];
plugin.setDestination(player, dest);
return true;
}
}