Do not use Bukkit#sendPluginMessage

This commit is contained in:
Dimatert9 2017-11-20 13:52:39 +02:00
parent ce490304ea
commit 0e0d8dff3d
2 changed files with 5 additions and 5 deletions

View File

@ -363,8 +363,4 @@ public class BukkitService implements SettingsDependent {
public BanEntry banIp(String ip, String reason, Date expires, String source) { public BanEntry banIp(String ip, String reason, Date expires, String source) {
return Bukkit.getServer().getBanList(BanList.Type.IP).addBan(ip, reason, expires, source); return Bukkit.getServer().getBanList(BanList.Type.IP).addBan(ip, reason, expires, source);
} }
public void sendPluginMessage(String channel, byte[] data) {
Bukkit.getServer().sendPluginMessage(authMe, channel, data);
}
} }

View File

@ -1,5 +1,6 @@
package fr.xephi.authme.service.bungeecord; package fr.xephi.authme.service.bungeecord;
import com.google.common.collect.Iterables;
import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
@ -52,7 +53,10 @@ public class BungeeSender implements SettingsDependent {
for (String element : data) { for (String element : data) {
out.writeUTF(element); out.writeUTF(element);
} }
bukkitService.sendPluginMessage("BungeeCord", out.toByteArray()); Player player = Iterables.getFirst(plugin.getServer().getOnlinePlayers(), null);
if (player != null) {
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
} }
/** /**