Plugin Messaging Conflict

Discussion in 'BungeeCord Plugin Development' started by Lazertx, Jul 14, 2015.

  1. I recently started to fix an old bungee - bukkit plugin that I used to develope, the plugin would use the BungeeCord channel to get the amount of players on a server. One major issue that I ran into while fixing it and couldn't fix is that many server owners get an error when using another plugin that uses the PlayerCount sub channel.

    They get this error
    Code (Text):
    [23:35:14] [Server thread/WARN]: java.lang.IllegalStateException:
    [23:35:14] [Server thread/WARN]:     at$ByteArrayDataInputStream.readUTF(
    [23:35:14] [Server thread/WARN]:     at com.lobbyswitch.ServerData.onPluginMessageReceived(
    [23:35:14] [Server thread/WARN]:     at org.bukkit.plugin.messaging.StandardMessenger.dispatchIncomingMessage(
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.PlayerConnection.a(
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.PacketPlayInCustomPayload.a(SourceFile:55)
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.PacketPlayInCustomPayload.a(SourceFile:8)
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$
    [23:35:14] [Server thread/WARN]:     at java.util.concurrent.Executors$ Source)
    [23:35:14] [Server thread/WARN]:     at Source)
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.SystemUtils.a(
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.B(
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.DedicatedServer.B(
    [23:35:14] [Server thread/WARN]:     at net.minecraft.server.v1_8_R3.MinecraftServer.A(
    [23:35:14] [Server thread/WARN]:     at
    [23:35:14] [Server thread/WARN]:     at Source)
    [23:35:14] [Server thread/WARN]: Caused by:
    [23:35:14] [Server thread/WARN]:     at Source)
    [23:35:14] [Server thread/WARN]:     at Source)
    [23:35:14] [Server thread/WARN]:     at Source)
    [23:35:14] [Server thread/WARN]:     at$ByteArrayDataInputStream.readUTF(
    [23:35:14] [Server thread/WARN]:     ... 14 more

    Here is the line that causes the error

    I think the issue has something to do with the plugins reading each others message, but I still don't completely understand why the message wouldn't be the same for each plugin.

    Any help would be greatly appreciated.
  2. Maybe you have to update your Java Version of the Project. You know > Project > Properties > Build Path > Java SE...

    I hope i could help.
  3. If you would read the error log, you would see, that it has nothing to do with the java version.
    @Lazertx: You can only use these channels if there is at least 1 player online on every server. Have you checked that?
  4. @Shadow3097
    If I am not mistaken messages are put into a queue for when a player gets online. The issue only happens when there are plugins such as BungeePlayerCounter installed and I have never received this error without the plugin.
  5. If you want to get only the player count from all bungee servers you can just ping any of them using the ping() method in the ServerInfo class if i remember correctly, if you want more features than the player count and to resolve the error, the error means you tried to read more data from the byte array than there was data for example, the bukkit plugin sent two strings but you tried to read three string which caused an EOF - End Of File Exception to resolve it make sure the data you're trying to read is containd in the message.

    If youre confues about the pinging part and want to see an example, reply and ill happily post a snippet of code that retrieves the player count from a server :)
    • Friendly Friendly x 1