Solved Plugin messaging channel

Discussion in 'Spigot Plugin Development' started by FiXed, May 26, 2016.

  1. So I've been looking at a bit of bungeecord stuff, I got a bit of it to work like connect, but I can't figure out how to send a plugin message without using a player, for example to get player count for a server, how would I send a message through the channel without using a player. Like I know it's "out.writUTF("PlayerCount")" etc but how do I send the message then get the output?
  2. Try using:

    Code (Text):
  3. How do I get the response?
  4. That is when a message is received, not when sending and reading a response.
    Edit: I believe player is null if the message doesn't require a player
  5. The api doesn't explain it very well, I'll read it over again and see what I can come up with.
  6. Read the entire thing, it's pretty easy to understand but you can't skip over the important parts
  7. PlayerCount(top)

    Get the amount of players on a certain server, or on ALL the servers.

    String the name of the server to get the player count of, or ALL to get the global player count

    Any player

    Code (Java):
    Code (Java):
    String server = in.readUTF(); // Name of server, as given in the arguments
    int playercount = in.readInt();

    See, I see this and I have no idea where he gets the value "in" I'm pretty sure I've read it over enough and the only time I see the variable in is the receiving bit which has a player arg so it's not making sense to me. Could you give me some pseudo code?
  9. Meh, people need to do their research on minecraft. A Plugin Message is just a packet that Minecraft once added. Bungeecord and the server itself are not directly connected. They use the plugin message packet through a player to communicate. If you want to do it without a player, either use something like a database or make them actually connected using sockets
  10. You don't need a player, maybe you should do some research.
    • Funny Funny x 1
  11. You NEED a player to send Plugin Messages! You might be able to send data without these channels, but via sockets/database and not via a plugin message.
  12. I dunno, I recall that in the past I was pulling data from a bungee network I was working for without needing players. Oh well.
  13. I got it, I did further research and found the answer, thanks for all your help.