blob: 40e77eb2dcfdaeb2b7e2293caba7138cea8b6003 (
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
49
50
51
52
53
54
55
56
|
package com.encrox.zombie;
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 Commander implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] args) {
try {
if(sender instanceof Player) {
Player player = (Player)sender;
switch(args[0]) {
case "lobby":
switch(args[1]) {
case "create":
if(player.hasPermission("zombie.create")) {
player.sendMessage(Zombie.createLobby(player, args[2], args[3]));
} else {
player.sendMessage(ChatColor.RED + Zombie.lang.getProperty("no_permission"));
}
break;
case "join":
if(player.hasPermission("zombie.join")) {
if(args.length == 3) {
player.sendMessage(Zombie.joinLobby(player, args[2]));
} else {
player.sendMessage(Zombie.listLobbies());
}
} else {
player.sendMessage(ChatColor.RED + Zombie.lang.getProperty("no_permission"));
}
break;
case "leave":
player.sendMessage(Zombie.removePlayer(player));
break;
case "start":
player.sendMessage(Zombie.start(player));
break;
}
break;
}
} else {
sender.sendMessage(Zombie.lang.getProperty("no_player"));
}
} catch(Exception e) {
e.printStackTrace();
return false;
}
return true;
}
}
|