-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAdminMode
More file actions
41 lines (24 loc) · 1.01 KB
/
AdminMode
File metadata and controls
41 lines (24 loc) · 1.01 KB
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
package me.dannydog.mc.fng
Public class AdminMode implements listener {
@EventHandler
public boolean onCommand(CommandSender sender, Command command, String label, string[]args) {
if(sender instanceof player) {
Player player = (Player) sender;
if(args.length == 0) {
player.sendMessage(ChatColor.YELLOW + "Invalid command, please use " + ChatColor.RED + "/x <on/off" + ChatColor.YELLOW + ".");
}
else if(args.length == 1) {
if(label.equalsIgnoreCase("x"){
if(args[0].equalsIgnoreCase("on"){
((Player) sender).setGameMode(GameMode.CREATIVE);
player.sendMessage(ChatColor.BLUE + "Admin mode " + ChatColor.LIGHT_BLUE + "enabled" + ChatColor.BLUE + ".");
}
if(args[0].equalsIgnoreCase("off"){
// This is wrong, re-doing soon. public PlayerGameModeChangeEvent(Player player, GameMode newGameMode)
player.sendMessage(ChatColor.BLUE + "Admin mode " + ChatColor.LIGHT_BLUE + "disabled" + ChatColor.BLUE + ".");
}
}
}
}
}
}