mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
Add sendtoall command
This commit is contained in:
parent
bcdbf9ba54
commit
acde2310c2
@ -205,6 +205,7 @@ public final class RedisBungee extends Plugin implements Listener {
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.FindCommand());
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.LastSeenCommand());
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.IpCommand());
|
||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.SendToAll());
|
||||
getProxy().getPluginManager().registerListener(this, this);
|
||||
api = new RedisBungeeAPI(this);
|
||||
psl = new PubSubListener();
|
||||
|
@ -33,6 +33,8 @@ class RedisBungeeCommands {
|
||||
new ComponentBuilder("").color(ChatColor.RED).append("You must specify a player name.").create();
|
||||
private static final BaseComponent[] PLAYER_NOT_FOUND =
|
||||
new ComponentBuilder("").color(ChatColor.RED).append("No such player found.").create();
|
||||
private static final BaseComponent[] NO_COMMAND_SPECIFIED =
|
||||
new ComponentBuilder("").color(ChatColor.RED).append("You must specify a command to be run.").create();
|
||||
|
||||
public static class GlistCommand extends Command {
|
||||
GlistCommand() {
|
||||
@ -144,4 +146,23 @@ class RedisBungeeCommands {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class SendToAll extends Command {
|
||||
SendToAll() {
|
||||
super("sendtoall", "redisbungee.command.sendtoall");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args) {
|
||||
if (args.length > 0) {
|
||||
String command = Joiner.on(" ").skipNulls().join(args);
|
||||
RedisBungee.getApi().sendProxyCommand(command);
|
||||
TextComponent message = new TextComponent();
|
||||
message.setColor(ChatColor.GREEN);
|
||||
message.setText("Sent the command /" + command + " to all proxies.");
|
||||
} else {
|
||||
sender.sendMessage(NO_COMMAND_SPECIFIED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user