2015-01-22 09:32:47 +01:00
|
|
|
package net.mc_pandacraft.java.plugin.pandacraftutils.commands;
|
2015-01-15 03:43:19 +01:00
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
|
2015-01-22 09:32:47 +01:00
|
|
|
public class CommandBroadcast extends AbstractCommandExecutor {
|
|
|
|
public CommandBroadcast() {
|
|
|
|
super("broadcast");
|
|
|
|
|
|
|
|
// classe qui gère deux commandes (presque identiques)
|
2015-01-17 21:03:54 +01:00
|
|
|
plugin.getCommand("broadcastperm").setExecutor(this);
|
2015-01-15 03:43:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
|
|
|
if (args.length == 0) return false;
|
|
|
|
|
2015-01-17 21:03:54 +01:00
|
|
|
|
|
|
|
if (label.equalsIgnoreCase("broadcast"))
|
|
|
|
{
|
|
|
|
plugin.broadcast(ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, ' ')), true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ici, il s'agit de /broadcastperm
|
|
|
|
if (args.length > 2) return false;
|
|
|
|
|
|
|
|
String perm = args[0];
|
|
|
|
args[0] = null;
|
|
|
|
|
|
|
|
|
|
|
|
plugin.broadcast(ChatColor.translateAlternateColorCodes('&', StringUtils.join(args, ' ')), true, perm);
|
|
|
|
|
2015-01-15 03:43:19 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|