2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2024-11-23 04:28:01 +00:00

Add server-id fetch and /serverid command

This commit is contained in:
Tux 2014-01-16 21:31:57 -05:00
parent b470b7a3df
commit d6afec5f47
3 changed files with 23 additions and 0 deletions

View File

@ -208,6 +208,7 @@ public final class RedisBungee extends Plugin implements Listener {
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.LastSeenCommand());
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.IpCommand());
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.SendToAll());
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerId());
getProxy().getPluginManager().registerListener(this, this);
api = new RedisBungeeAPI(this);
psl = new PubSubListener();

View File

@ -120,4 +120,12 @@ public class RedisBungeeAPI {
public final void sendProxyCommand(@NonNull String proxyId, @NonNull String command) {
plugin.sendProxyCommand(proxyId, command);
}
/**
* Get the current BungeeCord server ID for this server.
* @return the current server ID
*/
public final String getServerId() {
return RedisBungee.getConfiguration().getString("server-id");
}
}

View File

@ -165,4 +165,18 @@ class RedisBungeeCommands {
}
}
}
public static class ServerId extends Command {
ServerId() {
super("serverid", "redisbungee.command.serverid");
}
@Override
public void execute(CommandSender sender, String[] args) {
TextComponent textComponent = new TextComponent();
textComponent.setText("You are on " + RedisBungee.getApi().getServerId() + ".");
textComponent.setColor(ChatColor.YELLOW);
sender.sendMessage(textComponent);
}
}
}