mirror of
https://github.com/filoghost/HolographicDisplays.git
synced 2024-11-27 12:55:49 +01:00
Actually fix RedisBungee channel for 1.13+
This commit is contained in:
parent
8c09806c25
commit
7496bf8d4d
@ -48,19 +48,18 @@ public class BungeeChannel implements PluginMessageListener {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "BungeeCord");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "BungeeCord", this);
|
||||
|
||||
if (NMSVersion.isGreaterEqualThan(NMSVersion.v1_13_R1)) {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "legacy:redisbungee");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "legacy:redisbungee", this);
|
||||
} else {
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "RedisBungee");
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, "RedisBungee", this);
|
||||
}
|
||||
String targetChannel = "RedisBungee";
|
||||
if (NMSVersion.isGreaterEqualThan(NMSVersion.v1_13_R1)) targetChannel = "legacy:redisbungee";
|
||||
|
||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, targetChannel);
|
||||
Bukkit.getMessenger().registerIncomingPluginChannel(plugin, targetChannel, this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
String targetChannel = Configuration.useRedisBungee ? "RedisBungee" : "BungeeCord";
|
||||
|
||||
if (targetChannel.equalsIgnoreCase("RedisBungee") && NMSVersion.isGreaterEqualThan(NMSVersion.v1_13_R1)) targetChannel = "legacy:redisbungee";
|
||||
if (channel.equals(targetChannel)) {
|
||||
DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
|
||||
|
||||
@ -103,7 +102,9 @@ public class BungeeChannel implements PluginMessageListener {
|
||||
// OR, if you don't need to send it to a specific player
|
||||
Collection<? extends Player> players = Bukkit.getOnlinePlayers();
|
||||
if (players.size() > 0) {
|
||||
players.iterator().next().sendPluginMessage(HolographicDisplays.getInstance(), Configuration.useRedisBungee ? "RedisBungee" : "BungeeCord", b.toByteArray());
|
||||
String targetChannel = Configuration.useRedisBungee ? "RedisBungee" : "BungeeCord";
|
||||
if (targetChannel.equalsIgnoreCase("RedisBungee") && NMSVersion.isGreaterEqualThan(NMSVersion.v1_13_R1)) targetChannel = "legacy:redisbungee";
|
||||
players.iterator().next().sendPluginMessage(HolographicDisplays.getInstance(), targetChannel, b.toByteArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user