/[projects]/miscJava/bukkit-minecraft-plugins/whois/src/dk/thoerup/bukkit/whois/SetopnoteCommand.java
ViewVC logotype

Annotation of /miscJava/bukkit-minecraft-plugins/whois/src/dk/thoerup/bukkit/whois/SetopnoteCommand.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1603 - (hide annotations) (download)
Mon Sep 26 19:04:28 2011 UTC (12 years, 8 months ago) by torben
File size: 1052 byte(s)
imported whois plugin
1 torben 1603 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    
8     import org.bukkit.ChatColor;
9    
10     import org.bukkit.util.config.Configuration;
11    
12    
13     public class SetopnoteCommand implements CommandExecutor {
14     Configuration config;
15    
16     public SetopnoteCommand(Configuration config) {
17     this.config = config;
18     }
19    
20     @Override
21     public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
22    
23     if (!sender.isOp() ) {
24     sender.sendMessage(ChatColor.GREEN + "only operators may set opnote");
25     return true;
26     }
27    
28     if (args.length < 2) {
29     sender.sendMessage(ChatColor.GREEN + "Usage: /setopnote <player> <operator note>");
30     return true;
31     }
32    
33     String opnote = WhoisMain.concatStrings(args, 1);
34    
35    
36     String name = args[0].toLowerCase();
37    
38     config.setProperty( name + ".opnote", opnote );
39     config.save();
40    
41     sender.sendMessage(ChatColor.GREEN + "opnote info set for " + name);
42    
43     return true;
44     }
45     }

  ViewVC Help
Powered by ViewVC 1.1.20