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:
parent
8b55d8b35b
commit
efb707cd94
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user