2014-10-18 10:54:45 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.FPlayer;
|
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2015-01-22 00:58:33 +01:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
2014-10-25 20:22:41 +02:00
|
|
|
import org.apache.commons.lang.StringUtils;
|
2014-10-18 10:54:45 +02:00
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
public class CmdAnnounce extends FCommand {
|
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
public CmdAnnounce() {
|
|
|
|
super();
|
|
|
|
this.aliases.add("ann");
|
|
|
|
this.aliases.add("announce");
|
|
|
|
|
|
|
|
this.requiredArgs.add("message");
|
|
|
|
this.errorOnToManyArgs = false;
|
|
|
|
|
|
|
|
this.permission = Permission.ANNOUNCE.node;
|
|
|
|
this.disableOnLock = false;
|
2019-06-02 20:28:42 +02:00
|
|
|
this.disableOnSpam = false;
|
2019-03-03 04:51:21 +01:00
|
|
|
|
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = true;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeColeader = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
String prefix = ChatColor.GREEN + myFaction.getTag() + ChatColor.YELLOW + " [" + ChatColor.GRAY + me.getName() + ChatColor.YELLOW + "] " + ChatColor.RESET;
|
|
|
|
String message = StringUtils.join(args, " ");
|
|
|
|
|
|
|
|
for (Player player : myFaction.getOnlinePlayers()) {
|
|
|
|
player.sendMessage(prefix + message);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add for offline players.
|
|
|
|
for (FPlayer fp : myFaction.getFPlayersWhereOnline(false)) {
|
|
|
|
myFaction.addAnnouncement(fp, prefix + message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_ANNOUNCE_DESCRIPTION;
|
|
|
|
}
|
2015-01-22 00:58:33 +01:00
|
|
|
|
2014-10-18 10:54:45 +02:00
|
|
|
}
|