1 |
package dk.thoerup.bukkit.whois; |
2 |
|
3 |
import org.bukkit.command.Command; |
4 |
import org.bukkit.command.CommandExecutor; |
5 |
import org.bukkit.command.CommandSender; |
6 |
import org.bukkit.entity.Player; |
7 |
import org.bukkit.ChatColor; |
8 |
|
9 |
import org.bukkit.util.config.Configuration; |
10 |
|
11 |
|
12 |
public class AdmsetwhoisCommand implements CommandExecutor { |
13 |
Configuration config; |
14 |
|
15 |
public AdmsetwhoisCommand(Configuration config) { |
16 |
this.config = config; |
17 |
} |
18 |
|
19 |
@Override |
20 |
public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { |
21 |
|
22 |
|
23 |
if (!sender.isOp() ) { |
24 |
sender.sendMessage(ChatColor.GREEN + "You don't have permissions to use this command"); |
25 |
return true; |
26 |
} |
27 |
|
28 |
if (args.length < 2) { |
29 |
sender.sendMessage(ChatColor.GREEN + "Usage: /admsetwhois <player> <whois info>"); |
30 |
return true; |
31 |
} |
32 |
|
33 |
|
34 |
String whois = WhoisMain.concatStrings(args, 1); |
35 |
|
36 |
String name = args[0].toLowerCase(); |
37 |
|
38 |
config.setProperty( name + ".whois", whois ); |
39 |
config.save(); |
40 |
|
41 |
sender.sendMessage(ChatColor.GREEN + "Whois info set for " + name); |
42 |
|
43 |
return true; |
44 |
} |
45 |
} |