mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2026-05-03 11:40:29 +00:00
Add /pproxy command to request the proxy where a player is connected.
This commit is contained in:
@@ -200,6 +200,42 @@ class RedisBungeeCommands {
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerProxyCommand extends Command {
|
||||
private final RedisBungee plugin;
|
||||
|
||||
PlayerProxyCommand(RedisBungee plugin) {
|
||||
super("pproxy", "redisbungee.command.pproxy");
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (args.length > 0) {
|
||||
UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true);
|
||||
if (uuid == null) {
|
||||
sender.sendMessage(PLAYER_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
String proxy = RedisBungee.getApi().getProxy(uuid);
|
||||
if (proxy != null) {
|
||||
TextComponent message = new TextComponent();
|
||||
message.setColor(ChatColor.GREEN);
|
||||
message.setText(args[0] + " is connected to " + proxy + ".");
|
||||
sender.sendMessage(message);
|
||||
} else {
|
||||
sender.sendMessage(PLAYER_NOT_FOUND);
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(NO_PLAYER_SPECIFIED);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static class SendToAll extends Command {
|
||||
private final RedisBungee plugin;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user