Add alert command.
This commit is contained in:
parent
7901cdfed6
commit
914949d34e
@ -14,6 +14,7 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import static net.md_5.bungee.Logger.$;
|
import static net.md_5.bungee.Logger.$;
|
||||||
import net.md_5.bungee.command.Command;
|
import net.md_5.bungee.command.Command;
|
||||||
|
import net.md_5.bungee.command.CommandAlert;
|
||||||
import net.md_5.bungee.command.CommandEnd;
|
import net.md_5.bungee.command.CommandEnd;
|
||||||
import net.md_5.bungee.command.CommandIP;
|
import net.md_5.bungee.command.CommandIP;
|
||||||
import net.md_5.bungee.command.CommandList;
|
import net.md_5.bungee.command.CommandList;
|
||||||
@ -73,6 +74,7 @@ public class BungeeCord {
|
|||||||
commandMap.put("glist", new CommandList());
|
commandMap.put("glist", new CommandList());
|
||||||
commandMap.put("server", new CommandServer());
|
commandMap.put("server", new CommandServer());
|
||||||
commandMap.put("ip", new CommandIP());
|
commandMap.put("ip", new CommandIP());
|
||||||
|
commandMap.put("alert", new CommandAlert());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
31
src/main/java/net/md_5/bungee/command/CommandAlert.java
Normal file
31
src/main/java/net/md_5/bungee/command/CommandAlert.java
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package net.md_5.bungee.command;
|
||||||
|
|
||||||
|
import net.md_5.bungee.BungeeCord;
|
||||||
|
import net.md_5.bungee.ChatColor;
|
||||||
|
import net.md_5.bungee.Permission;
|
||||||
|
import net.md_5.bungee.UserConnection;
|
||||||
|
|
||||||
|
public class CommandAlert extends Command {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String[] args) {
|
||||||
|
if (getPermission(sender) != Permission.ADMIN) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "You do not have permission to execute this command!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (args.length == 0) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "Please follow this command by an announcement to make");
|
||||||
|
} else {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(ChatColor.DARK_PURPLE);
|
||||||
|
builder.append(" [Alert] ");
|
||||||
|
for (String s : args) {
|
||||||
|
builder.append(s);
|
||||||
|
}
|
||||||
|
String message = builder.toString();
|
||||||
|
for (UserConnection con : BungeeCord.instance.connections.values()) {
|
||||||
|
con.sendMessage(message.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user