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

Simplify PubSub code.

This commit is contained in:
Tux 2015-06-24 05:54:19 -04:00
parent 32f0dffd85
commit 2c22bc4439

View File

@ -36,6 +36,7 @@ import com.squareup.okhttp.Dispatcher;
import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.OkHttpClient;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull; import lombok.NonNull;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin; 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 { class PubSubListener implements Runnable {
private Jedis rsc;
private JedisPubSubHandler jpsh; private JedisPubSubHandler jpsh;
private PubSubListener() {
}
@Override @Override
public void run() { public void run() {
try { try (Jedis rsc = pool.getResource()) {
rsc = pool.getResource();
jpsh = new JedisPubSubHandler(); jpsh = new JedisPubSubHandler();
rsc.subscribe(jpsh, "redisbungee-" + configuration.getServerId(), "redisbungee-allservers", "redisbungee-data"); rsc.subscribe(jpsh, "redisbungee-" + configuration.getServerId(), "redisbungee-allservers", "redisbungee-data");
} catch (JedisException | ClassCastException ignored) { } 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) {
}
} }
} }