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

add sendProxyCommand methods

This commit is contained in:
vemacs 2014-01-01 17:05:55 -07:00
parent 8b55d8b35b
commit efb707cd94
2 changed files with 26 additions and 0 deletions

View File

@ -159,6 +159,15 @@ public final class RedisBungee extends Plugin implements Listener {
return ia;
}
final void sendProxyCommand(String proxyId, String command) {
Jedis jedis = pool.getResource();
try {
jedis.publish("redisbungee-" + proxyId, command);
} finally {
pool.returnResource(jedis);
}
}
@Override
public void onEnable() {
plugin = this;

View File

@ -94,4 +94,21 @@ public class RedisBungeeAPI {
public final InetAddress getPlayerIp(@NonNull String player) {
return plugin.getIpAddress(player);
}
/**
* Sends a proxy command to all proxies.
* @param command the command to send and execute
*/
public final void sendProxyCommand(String command) {
plugin.sendProxyCommand("allservers", command);
}
/**
* Sends a proxy command to the proxy with the given ID.
* @param proxyId a proxy ID
* @param command the command to send and execute
*/
public final void sendProxyCommand(String proxyId, String command) {
plugin.sendProxyCommand(proxyId, command);
}
}