mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-12-23 18:48:02 +00:00
Add server-id fetch and /serverid command
This commit is contained in:
parent
b470b7a3df
commit
d6afec5f47
@ -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();
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user