mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-12-19 23:37:33 +01:00
Improve code readability
This commit is contained in:
parent
e4ece4dc80
commit
137d23b408
@ -30,7 +30,7 @@ public class BungeeChannel implements PluginMessageListener {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public BungeeChannel(Plugin plugin) {
|
||||
private BungeeChannel(Plugin plugin) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "BungeeCord", this);
|
||||
|
||||
@ -44,33 +44,15 @@ public class BungeeChannel implements PluginMessageListener {
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
String targetChannel = Configuration.useRedisBungee ? "RedisBungee" : "BungeeCord";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (channel.equals(targetChannel)) {
|
||||
DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
|
||||
|
||||
try {
|
||||
String subChannel = in.readUTF();
|
||||
|
||||
if (subChannel.equals("PlayerCount")) {
|
||||
|
||||
String server = in.readUTF();
|
||||
|
||||
if (in.available() > 0) {
|
||||
@ -88,6 +70,7 @@ public class BungeeChannel implements PluginMessageListener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void askPlayerCount(String server) {
|
||||
|
Loading…
Reference in New Issue
Block a user