mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-23 04:28:01 +00:00
Add exempted IP addresses (closes #19) and refactored configuration.
This commit is contained in:
parent
195857a531
commit
10466a9464
@ -80,7 +80,7 @@ public class DataManager implements Listener {
|
|||||||
ProxiedPlayer player = plugin.getProxy().getPlayer(uuid);
|
ProxiedPlayer player = plugin.getProxy().getPlayer(uuid);
|
||||||
|
|
||||||
if (player != null)
|
if (player != null)
|
||||||
return plugin.getServerId();
|
return RedisBungee.getConfiguration().getServerId();
|
||||||
|
|
||||||
String server = proxyCache.get(uuid);
|
String server = proxyCache.get(uuid);
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ public class DataManager implements Listener {
|
|||||||
plugin.getLogger().info("I found a funny number for when " + uuid + " was last online!");
|
plugin.getLogger().info("I found a funny number for when " + uuid + " was last online!");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (String proxyId : plugin.getServerIds()) {
|
for (String proxyId : plugin.getServerIds()) {
|
||||||
if (proxyId.equals(plugin.getServerId())) continue;
|
if (proxyId.equals(RedisBungee.getConfiguration().getServerId())) continue;
|
||||||
if (tmpRsc.sismember("proxy:" + proxyId + ":usersOnline", uuid.toString())) {
|
if (tmpRsc.sismember("proxy:" + proxyId + ":usersOnline", uuid.toString())) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@ -225,7 +225,7 @@ public class DataManager implements Listener {
|
|||||||
|
|
||||||
String source = jsonObject.get("source").getAsString();
|
String source = jsonObject.get("source").getAsString();
|
||||||
|
|
||||||
if (source.equals(plugin.getServerId()))
|
if (source.equals(RedisBungee.getConfiguration().getServerId()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DataManagerMessage.Action action = DataManagerMessage.Action.valueOf(jsonObject.get("action").getAsString());
|
DataManagerMessage.Action action = DataManagerMessage.Action.valueOf(jsonObject.get("action").getAsString());
|
||||||
|
@ -16,6 +16,7 @@ import com.imaginarycode.minecraft.redisbungee.util.UUIDFetcher;
|
|||||||
import com.imaginarycode.minecraft.redisbungee.util.UUIDTranslator;
|
import com.imaginarycode.minecraft.redisbungee.util.UUIDTranslator;
|
||||||
import com.squareup.okhttp.Dispatcher;
|
import com.squareup.okhttp.Dispatcher;
|
||||||
import com.squareup.okhttp.OkHttpClient;
|
import com.squareup.okhttp.OkHttpClient;
|
||||||
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
@ -45,17 +46,17 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|||||||
* The only function of interest is {@link #getApi()}, which exposes some functions in this class.
|
* The only function of interest is {@link #getApi()}, which exposes some functions in this class.
|
||||||
*/
|
*/
|
||||||
public final class RedisBungee extends Plugin {
|
public final class RedisBungee extends Plugin {
|
||||||
private static Configuration configuration;
|
|
||||||
@Getter
|
@Getter
|
||||||
private static Gson gson = new Gson();
|
private static Gson gson = new Gson();
|
||||||
private static RedisBungeeAPI api;
|
private static RedisBungeeAPI api;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private static PubSubListener psl = null;
|
private static PubSubListener psl = null;
|
||||||
@Getter
|
@Getter
|
||||||
private JedisPool pool;
|
private JedisPool pool;
|
||||||
@Getter
|
@Getter
|
||||||
private UUIDTranslator uuidTranslator;
|
private UUIDTranslator uuidTranslator;
|
||||||
@Getter
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private String serverId;
|
private static RedisBungeeConfiguration configuration;
|
||||||
@Getter
|
@Getter
|
||||||
private DataManager dataManager;
|
private DataManager dataManager;
|
||||||
@Getter
|
@Getter
|
||||||
@ -77,10 +78,6 @@ public final class RedisBungee extends Plugin {
|
|||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Configuration getConfiguration() {
|
|
||||||
return configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PubSubListener getPubSubListener() {
|
static PubSubListener getPubSubListener() {
|
||||||
return psl;
|
return psl;
|
||||||
}
|
}
|
||||||
@ -114,7 +111,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
getLogger().log(Level.SEVERE, "Unable to fetch all server IDs", e);
|
getLogger().log(Level.SEVERE, "Unable to fetch all server IDs", e);
|
||||||
if (jedis != null)
|
if (jedis != null)
|
||||||
pool.returnBrokenResource(jedis);
|
pool.returnBrokenResource(jedis);
|
||||||
return Collections.singletonList(serverId);
|
return Collections.singletonList(configuration.getServerId());
|
||||||
} finally {
|
} finally {
|
||||||
pool.returnResource(jedis);
|
pool.returnResource(jedis);
|
||||||
}
|
}
|
||||||
@ -164,15 +161,12 @@ public final class RedisBungee extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Set<UUID> getPlayers() {
|
final Set<UUID> getPlayers() {
|
||||||
ImmutableSet.Builder<UUID> setBuilder = ImmutableSet.<UUID>builder().addAll(getLocalPlayers());
|
ImmutableSet.Builder<UUID> setBuilder = ImmutableSet.builder();
|
||||||
if (pool != null) {
|
if (pool != null) {
|
||||||
Jedis rsc = pool.getResource();
|
Jedis rsc = pool.getResource();
|
||||||
try {
|
try {
|
||||||
List<String> keys = new ArrayList<>();
|
List<String> keys = new ArrayList<>();
|
||||||
for (String i : getServerIds()) {
|
for (String i : getServerIds()) {
|
||||||
if (i.equals(serverId))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
keys.add("proxy:" + i + ":usersOnline");
|
keys.add("proxy:" + i + ":usersOnline");
|
||||||
}
|
}
|
||||||
if (!keys.isEmpty()) {
|
if (!keys.isEmpty()) {
|
||||||
@ -236,7 +230,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
if (pool != null) {
|
if (pool != null) {
|
||||||
Jedis tmpRsc = pool.getResource();
|
Jedis tmpRsc = pool.getResource();
|
||||||
try {
|
try {
|
||||||
tmpRsc.hset("heartbeats", serverId, String.valueOf(System.nanoTime()));
|
tmpRsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.nanoTime()));
|
||||||
} finally {
|
} finally {
|
||||||
pool.returnResource(tmpRsc);
|
pool.returnResource(tmpRsc);
|
||||||
}
|
}
|
||||||
@ -247,7 +241,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
public void run() {
|
public void run() {
|
||||||
Jedis rsc = pool.getResource();
|
Jedis rsc = pool.getResource();
|
||||||
try {
|
try {
|
||||||
rsc.hset("heartbeats", serverId, String.valueOf(System.nanoTime()));
|
rsc.hset("heartbeats", configuration.getServerId(), String.valueOf(System.nanoTime()));
|
||||||
} catch (JedisConnectionException e) {
|
} catch (JedisConnectionException e) {
|
||||||
// Redis server has disappeared!
|
// Redis server has disappeared!
|
||||||
getLogger().log(Level.SEVERE, "Unable to update heartbeat - did your Redis server go away?", e);
|
getLogger().log(Level.SEVERE, "Unable to update heartbeat - did your Redis server go away?", e);
|
||||||
@ -259,7 +253,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
}
|
}
|
||||||
}, 0, 3, TimeUnit.SECONDS);
|
}, 0, 3, TimeUnit.SECONDS);
|
||||||
dataManager = new DataManager(this);
|
dataManager = new DataManager(this);
|
||||||
if (configuration.getBoolean("register-bungee-commands", true)) {
|
if (configuration.isRegisterBungeeCommands()) {
|
||||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.GlistCommand(this));
|
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.GlistCommand(this));
|
||||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.FindCommand(this));
|
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.FindCommand(this));
|
||||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.LastSeenCommand(this));
|
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.LastSeenCommand(this));
|
||||||
@ -270,7 +264,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerIds());
|
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.ServerIds());
|
||||||
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlayerProxyCommand(this));
|
getProxy().getPluginManager().registerCommand(this, new RedisBungeeCommands.PlayerProxyCommand(this));
|
||||||
api = new RedisBungeeAPI(this);
|
api = new RedisBungeeAPI(this);
|
||||||
getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this));
|
getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this, configuration.getExemptAddresses()));
|
||||||
getProxy().getPluginManager().registerListener(this, dataManager);
|
getProxy().getPluginManager().registerListener(this, dataManager);
|
||||||
psl = new PubSubListener();
|
psl = new PubSubListener();
|
||||||
getProxy().getScheduler().runAsync(this, psl);
|
getProxy().getScheduler().runAsync(this, psl);
|
||||||
@ -280,14 +274,14 @@ public final class RedisBungee extends Plugin {
|
|||||||
Jedis tmpRsc = pool.getResource();
|
Jedis tmpRsc = pool.getResource();
|
||||||
try {
|
try {
|
||||||
Set<String> players = new HashSet<>(getLocalPlayersAsUuidStrings());
|
Set<String> players = new HashSet<>(getLocalPlayersAsUuidStrings());
|
||||||
Set<String> redisCollection = tmpRsc.smembers("proxy:" + serverId + ":usersOnline");
|
Set<String> redisCollection = tmpRsc.smembers("proxy:" + configuration.getServerId() + ":usersOnline");
|
||||||
|
|
||||||
for (String member : redisCollection) {
|
for (String member : redisCollection) {
|
||||||
if (!players.contains(member)) {
|
if (!players.contains(member)) {
|
||||||
// Are they simply on a different proxy?
|
// Are they simply on a different proxy?
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (String proxyId : getServerIds()) {
|
for (String proxyId : getServerIds()) {
|
||||||
if (proxyId.equals(serverId)) continue;
|
if (proxyId.equals(configuration.getServerId())) continue;
|
||||||
if (tmpRsc.sismember("proxy:" + proxyId + ":usersOnline", member)) {
|
if (tmpRsc.sismember("proxy:" + proxyId + ":usersOnline", member)) {
|
||||||
// Just clean up the set.
|
// Just clean up the set.
|
||||||
found = true;
|
found = true;
|
||||||
@ -298,7 +292,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
RedisUtil.cleanUpPlayer(member, tmpRsc);
|
RedisUtil.cleanUpPlayer(member, tmpRsc);
|
||||||
getLogger().warning("Player found in set that was not found locally and globally: " + member);
|
getLogger().warning("Player found in set that was not found locally and globally: " + member);
|
||||||
} else {
|
} else {
|
||||||
tmpRsc.srem("proxy:" + serverId + ":usersOnline", member);
|
tmpRsc.srem("proxy:" + configuration.getServerId() + ":usersOnline", member);
|
||||||
getLogger().warning("Player found in set that was not found locally, but is on another proxy: " + member);
|
getLogger().warning("Player found in set that was not found locally, but is on another proxy: " + member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,7 +304,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
|
|
||||||
// Player not online according to Redis but not BungeeCord. Fire another consumer event.
|
// Player not online according to Redis but not BungeeCord. Fire another consumer event.
|
||||||
getLogger().warning("Player " + player + " is on the proxy but not in Redis.");
|
getLogger().warning("Player " + player + " is on the proxy but not in Redis.");
|
||||||
tmpRsc.sadd("proxy:" + serverId + ":usersOnline", player);
|
tmpRsc.sadd("proxy:" + configuration.getServerId() + ":usersOnline", player);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
pool.returnResource(tmpRsc);
|
pool.returnResource(tmpRsc);
|
||||||
@ -343,9 +337,9 @@ public final class RedisBungee extends Plugin {
|
|||||||
|
|
||||||
Jedis tmpRsc = pool.getResource();
|
Jedis tmpRsc = pool.getResource();
|
||||||
try {
|
try {
|
||||||
tmpRsc.hdel("heartbeats", serverId);
|
tmpRsc.hdel("heartbeats", configuration.getServerId());
|
||||||
if (tmpRsc.scard("proxy:" + serverId + ":usersOnline") > 0) {
|
if (tmpRsc.scard("proxy:" + configuration.getServerId() + ":usersOnline") > 0) {
|
||||||
Set<String> players = tmpRsc.smembers("proxy:" + serverId + ":usersOnline");
|
Set<String> players = tmpRsc.smembers("proxy:" + configuration.getServerId() + ":usersOnline");
|
||||||
for (String member : players)
|
for (String member : players)
|
||||||
RedisUtil.cleanUpPlayer(member, tmpRsc);
|
RedisUtil.cleanUpPlayer(member, tmpRsc);
|
||||||
}
|
}
|
||||||
@ -372,12 +366,12 @@ public final class RedisBungee extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
|
final Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
|
||||||
|
|
||||||
final String redisServer = configuration.getString("redis-server", "localhost");
|
final String redisServer = configuration.getString("redis-server", "localhost");
|
||||||
final int redisPort = configuration.getInt("redis-port", 6379);
|
final int redisPort = configuration.getInt("redis-port", 6379);
|
||||||
String redisPassword = configuration.getString("redis-password");
|
String redisPassword = configuration.getString("redis-password");
|
||||||
serverId = configuration.getString("server-id");
|
String serverId = configuration.getString("server-id");
|
||||||
|
|
||||||
if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) {
|
if (redisPassword != null && (redisPassword.isEmpty() || redisPassword.equals("none"))) {
|
||||||
redisPassword = null;
|
redisPassword = null;
|
||||||
@ -439,6 +433,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
httpClient.setDispatcher(dispatcher);
|
httpClient.setDispatcher(dispatcher);
|
||||||
NameFetcher.setHttpClient(httpClient);
|
NameFetcher.setHttpClient(httpClient);
|
||||||
UUIDFetcher.setHttpClient(httpClient);
|
UUIDFetcher.setHttpClient(httpClient);
|
||||||
|
RedisBungee.configuration = new RedisBungeeConfiguration(RedisBungee.this.getPool(), configuration);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -481,7 +476,7 @@ public final class RedisBungee extends Plugin {
|
|||||||
try {
|
try {
|
||||||
rsc = pool.getResource();
|
rsc = pool.getResource();
|
||||||
jpsh = new JedisPubSubHandler();
|
jpsh = new JedisPubSubHandler();
|
||||||
rsc.subscribe(jpsh, "redisbungee-" + serverId, "redisbungee-allservers", "redisbungee-data");
|
rsc.subscribe(jpsh, "redisbungee-" + configuration.getServerId(), "redisbungee-allservers", "redisbungee-data");
|
||||||
} catch (JedisException | ClassCastException ignored) {
|
} catch (JedisException | ClassCastException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class RedisBungeeAPI {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.reservedChannels = ImmutableList.of(
|
this.reservedChannels = ImmutableList.of(
|
||||||
"redisbungee-allservers",
|
"redisbungee-allservers",
|
||||||
"redisbungee-" + plugin.getServerId(),
|
"redisbungee-" + RedisBungee.getConfiguration().getServerId(),
|
||||||
"redisbungee-data"
|
"redisbungee-data"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ public class RedisBungeeAPI {
|
|||||||
* @since 0.2.5
|
* @since 0.2.5
|
||||||
*/
|
*/
|
||||||
public final String getServerId() {
|
public final String getServerId() {
|
||||||
return plugin.getServerId();
|
return RedisBungee.getConfiguration().getServerId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ class RedisBungeeCommands {
|
|||||||
BaseComponent[] playersOnline = new ComponentBuilder("").color(ChatColor.YELLOW).append(String.valueOf(count))
|
BaseComponent[] playersOnline = new ComponentBuilder("").color(ChatColor.YELLOW).append(String.valueOf(count))
|
||||||
.append(" player(s) are currently online.").create();
|
.append(" player(s) are currently online.").create();
|
||||||
if (args.length > 0 && args[0].equals("showall")) {
|
if (args.length > 0 && args[0].equals("showall")) {
|
||||||
if (RedisBungee.getConfiguration().getBoolean("canonical-glist", true)) {
|
if (RedisBungee.getConfiguration().isCanonicalGlist()) {
|
||||||
Multimap<String, UUID> serverToPlayers = RedisBungee.getApi().getServerToPlayers();
|
Multimap<String, UUID> serverToPlayers = RedisBungee.getApi().getServerToPlayers();
|
||||||
Multimap<String, String> human = HashMultimap.create();
|
Multimap<String, String> human = HashMultimap.create();
|
||||||
for (Map.Entry<String, UUID> entry : serverToPlayers.entries()) {
|
for (Map.Entry<String, UUID> entry : serverToPlayers.entries()) {
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Copyright © 2013 tuxed <write@imaginarycode.com>
|
||||||
|
* This work is free. You can redistribute it and/or modify it under the
|
||||||
|
* terms of the Do What The Fuck You Want To Public License, Version 2,
|
||||||
|
* as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
|
||||||
|
*/
|
||||||
|
package com.imaginarycode.minecraft.redisbungee;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.net.InetAddresses;
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.md_5.bungee.config.Configuration;
|
||||||
|
import redis.clients.jedis.JedisPool;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RedisBungeeConfiguration {
|
||||||
|
@Getter
|
||||||
|
private final JedisPool pool;
|
||||||
|
@Getter
|
||||||
|
private final String serverId;
|
||||||
|
@Getter
|
||||||
|
private final boolean registerBungeeCommands;
|
||||||
|
@Getter
|
||||||
|
private final boolean canonicalGlist;
|
||||||
|
@Getter
|
||||||
|
private final List<InetAddress> exemptAddresses;
|
||||||
|
|
||||||
|
public RedisBungeeConfiguration(JedisPool pool, Configuration configuration) {
|
||||||
|
this.pool = pool;
|
||||||
|
this.serverId = configuration.getString("server-id");
|
||||||
|
this.registerBungeeCommands = configuration.getBoolean("register-bungee-commands", true);
|
||||||
|
this.canonicalGlist = configuration.getBoolean("canonical-glist", true);
|
||||||
|
|
||||||
|
List<String> stringified = configuration.getStringList("exempt-ip-addresses");
|
||||||
|
ImmutableList.Builder<InetAddress> addressBuilder = ImmutableList.builder();
|
||||||
|
|
||||||
|
for (String s : stringified) {
|
||||||
|
addressBuilder.add(InetAddresses.forString(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.exemptAddresses = addressBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@ import net.md_5.bungee.event.EventHandler;
|
|||||||
import net.md_5.bungee.event.EventPriority;
|
import net.md_5.bungee.event.EventPriority;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ public class RedisBungeeListener implements Listener {
|
|||||||
.color(ChatColor.GRAY)
|
.color(ChatColor.GRAY)
|
||||||
.create();
|
.create();
|
||||||
private final RedisBungee plugin;
|
private final RedisBungee plugin;
|
||||||
|
private final List<InetAddress> exemptAddresses;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerConnect(final PostLoginEvent event) {
|
public void onPlayerConnect(final PostLoginEvent event) {
|
||||||
@ -54,7 +56,7 @@ public class RedisBungeeListener implements Listener {
|
|||||||
jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "online", "0");
|
jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "online", "0");
|
||||||
jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "ip", event.getPlayer().getAddress().getAddress().getHostAddress());
|
jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "ip", event.getPlayer().getAddress().getAddress().getHostAddress());
|
||||||
plugin.getUuidTranslator().persistInfo(event.getPlayer().getName(), event.getPlayer().getUniqueId(), jedis);
|
plugin.getUuidTranslator().persistInfo(event.getPlayer().getName(), event.getPlayer().getUniqueId(), jedis);
|
||||||
jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "proxy", plugin.getServerId());
|
jedis.hset("player:" + event.getPlayer().getUniqueId().toString(), "proxy", RedisBungee.getConfiguration().getServerId());
|
||||||
jedis.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
|
jedis.publish("redisbungee-data", RedisBungee.getGson().toJson(new DataManager.DataManagerMessage<>(
|
||||||
event.getPlayer().getUniqueId(), DataManager.DataManagerMessage.Action.JOIN,
|
event.getPlayer().getUniqueId(), DataManager.DataManagerMessage.Action.JOIN,
|
||||||
new DataManager.LoginPayload(event.getPlayer().getAddress().getAddress()))));
|
new DataManager.LoginPayload(event.getPlayer().getAddress().getAddress()))));
|
||||||
@ -98,6 +100,10 @@ public class RedisBungeeListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPing(final ProxyPingEvent event) {
|
public void onPing(final ProxyPingEvent event) {
|
||||||
|
if (exemptAddresses.contains(event.getConnection().getAddress().getAddress())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.registerIntent(plugin);
|
event.registerIntent(plugin);
|
||||||
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
plugin.getProxy().getScheduler().runAsync(plugin, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,3 +28,7 @@ register-bungee-commands: true
|
|||||||
|
|
||||||
# Whether or not /glist showall output should match vanilla BungeeCord.
|
# Whether or not /glist showall output should match vanilla BungeeCord.
|
||||||
canonical-glist: true
|
canonical-glist: true
|
||||||
|
|
||||||
|
# A list of IP addresses for which RedisBungee will not modify the response for, useful for automatic
|
||||||
|
# restart scripts.
|
||||||
|
exempt-ip-addresses: []
|
Loading…
Reference in New Issue
Block a user