mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-22 20:28:00 +00:00
Simplify PubSub code.
This commit is contained in:
parent
32f0dffd85
commit
2c22bc4439
@ -36,6 +36,7 @@ import com.squareup.okhttp.Dispatcher;
|
||||
import com.squareup.okhttp.OkHttpClient;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
@ -496,17 +497,13 @@ public final class RedisBungee extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
class PubSubListener implements Runnable {
|
||||
private Jedis rsc;
|
||||
private JedisPubSubHandler jpsh;
|
||||
|
||||
private PubSubListener() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
rsc = pool.getResource();
|
||||
try (Jedis rsc = pool.getResource()) {
|
||||
jpsh = new JedisPubSubHandler();
|
||||
rsc.subscribe(jpsh, "redisbungee-" + configuration.getServerId(), "redisbungee-allservers", "redisbungee-data");
|
||||
} catch (JedisException | ClassCastException ignored) {
|
||||
@ -537,25 +534,5 @@ public final class RedisBungee extends Plugin {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPMessage(String s, String s2, String s3) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(String s, int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUnsubscribe(String s, int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPUnsubscribe(String s, int i) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPSubscribe(String s, int i) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user