BGHDDevelopment / PlayerBalancer

The repository for the plugin PlayerBalancer
https://www.spigotmc.org/resources/55011/
MIT License
28 stars 24 forks source link

Issues #19

Closed BGHDDevelopment closed 3 years ago

BGHDDevelopment commented 3 years ago

Hey!

Running into a few issues so wanted to see if these were known or if something on my end is going wrong.

  1. /balancer paste seems to be returning a 503 error and kicking the player who runs the command for "Timed Out". Log/Error: https://pastebin.com/ZpSgjYUg

  2. I also seem to be having an issue while using the API/Messaging Channel on the latest version of the plugin and bungee. During this test, I was using a 1.8.8 BuildTools created spigot base. BungeeBuild: nTWLc9

Here is the code I was using to send the player: TYABfD Registered the outgoing channel in onEnable: 9GlhbF

It just seems to not send the player at all and returns no errors which is very strange. I have used this code in the past about a year back and it seemed to work fine then which makes me think something changed in new bungee builds or something.

I am able to use the /section commands to send myself to the server section using "survival" so it should be working fine via the messaging channel but weirdly does not.

I also tested on a 1.16.5 spigot build and kept getting: Caused by: java.lang.IllegalArgumentException: Channel must contain : separator (attempted to use PlayerBalancer)

For reference here is my PlayerBlancer config (NOTE: This is my test server setup, I use more than 2 servers for the production setup): https://pastebin.com/FGD7kGsH

jamezrin commented 3 years ago

Hello there,

The first issue could be temporary or caused by an update of hastebin, I will investigate it tomorrow.

As for the second issue, I think that in 1.12 or 1.13 the Messaging Channel API was updated to require a namespace/scope separated by the :.

So to use the API in spigot versions > 1.13 do something like this https://github.com/jamezrin/PlayerBalancer/blob/master/addon/src/main/java/com/jaimemartz/playerbalanceraddon/PluginMessageManager.java

I'm not sure how you would call the API from older versions of Spigot such as 1.8.8, but it's possible that the namespaced channel will still work.

I wanted to implement this API using Redis PubSub #18 (which would give the API more flexibility) but I haven't got to it yet.

BGHDDevelopment commented 3 years ago

Will go ahead and test with the : tomorrow to see if I can get that to work. I Will let you know what happens.

BGHDDevelopment commented 3 years ago

Went ahead and did some testing this morning. Using the new namespace does solve the issue. My guess is it must be used regardless of base spigot version as it seems to work on all versions between 1.8-1.16.x. (I did not test 1.7)

For future reference for anyone who has the same issue use: getServer().getMessenger().registerOutgoingPluginChannel(this, "playerbalancer:main");

Then an example for sending a player to lobby:

    public void sendToServer(Player player) {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        out.writeUTF("Connect");
        out.writeUTF("general-lobbies");
        player.sendPluginMessage(plugin, "playerbalancer:main", out.toByteArray());
    }

Thanks for the help @jamezrin! May want to update the API section of the spigot page so people don't keep asking the same thing. 👍 Will leave this open for the first hastebin issue to be checked into.

jamezrin commented 3 years ago

Good to hear that! I updated the documentation and released v2.2.2 which should fix the issues with the paste command. I didn't know that hastebin was abandoned... To fix it I just replaced the URL with an alternative hastebin server that has a good reputation and called it done.

BGHDDevelopment commented 3 years ago

Sounds good! Thank you!