mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-18 14:57:35 +01:00
Do not track the channel "BungeeCord" when using "RedisBungee" and
viceversa.
This commit is contained in:
parent
fe4099223f
commit
2187a7670a
@ -35,26 +35,42 @@ public class BungeeChannel implements PluginMessageListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||||
if (!channel.equals("BungeeCord") && !channel.equals("RedisBungee")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
|
if (channel.equals("BungeeCord")) {
|
||||||
|
|
||||||
|
if (Configuration.useRedisBungee) {
|
||||||
|
// If we use RedisBungee, we must ignore this channel.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (channel.equals("RedisBungee")) {
|
||||||
|
|
||||||
|
if (!Configuration.useRedisBungee) {
|
||||||
|
// Same as above, just the opposite case.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Not our channels, ignore the message.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String subChannel = in.readUTF();
|
String subChannel = in.readUTF();
|
||||||
|
|
||||||
if (subChannel.equals("PlayerCount")) {
|
if (subChannel.equals("PlayerCount")) {
|
||||||
|
|
||||||
String server = in.readUTF();
|
String server = in.readUTF();
|
||||||
|
|
||||||
if (in.available() > 0) {
|
if (in.available() > 0) {
|
||||||
int online = in.readInt();
|
int online = in.readInt();
|
||||||
|
|
||||||
BungeeServerInfo serverInfo = BungeeServerTracker.getOrCreateServerInfo(server);
|
BungeeServerInfo serverInfo = BungeeServerTracker.getOrCreateServerInfo(server);
|
||||||
serverInfo.setOnlinePlayers(online);
|
serverInfo.setOnlinePlayers(online);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (EOFException e) {
|
} catch (EOFException e) {
|
||||||
// Do nothing.
|
// Do nothing.
|
||||||
|
Loading…
Reference in New Issue
Block a user