/[projects]/miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/WallCommand.java
ViewVC logotype

Annotation of /miscJava/bukkit-minecraft-plugins/HoerupUtils/src/dk/thoerup/bukkit/hoeruputils/WallCommand.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1590 - (hide annotations) (download)
Tue Aug 16 16:04:01 2011 UTC (12 years, 9 months ago) by torben
File size: 1022 byte(s)
added /wall commando og fixet bug in (power/super)miner
1 torben 1590 package dk.thoerup.bukkit.hoeruputils;
2    
3     import org.bukkit.ChatColor;
4     import org.bukkit.Server;
5     import org.bukkit.command.Command;
6     import org.bukkit.command.CommandExecutor;
7     import org.bukkit.command.CommandSender;
8     import org.bukkit.entity.Player;
9    
10     public class WallCommand implements CommandExecutor {
11    
12    
13     @Override
14     public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
15    
16     if (!(sender instanceof Player)) {
17     return false;
18     }
19     Player p = (Player) sender;
20    
21     if (!p.hasPermission("hoeruputils.wall")) {
22     p.sendMessage("You don't have permissions to use /wall");
23     return true;
24     }
25    
26     final Server server = sender.getServer();
27    
28     StringBuilder msg = new StringBuilder();
29     msg.append( ChatColor.GREEN + "[" + p.getName() + "] " );
30     for (String s : args) {
31     msg.append( s + " ");
32     }
33    
34     for (Player player : server.getOnlinePlayers() ) {
35     if (player.hasPermission("hoeruputils.wall")) {
36    
37     player.sendMessage( msg.toString() );
38     }
39     }
40    
41    
42    
43     return true;
44     }
45     }

  ViewVC Help
Powered by ViewVC 1.1.20