1. Welcome to LilyPad. Download the project, explore the forums, and create your own LilyPad network.

    If you use the software and enjoy it or have a question, or would like to contribute to the future of the software directly or through resources, please sign up and join our little community.

Confirmed [SOLVED] RedirectResult always returning StatusCode SUCCESS

Discussion in 'Bug Reports' started by Superfuzzy, Aug 11, 2014.

  1. Superfuzzy

    Superfuzzy Member


    Explanation of Bug: Whenever I redirect a Player in my Plugin the Statuscode that the RedirectResult returns is SUCCESS. Even when the player is never redirected (because e.g. the other server is offline).
    I'm sending a message to the Player about the Result and the message always says that the redirect was successful.

    The Bug: The RedirectResult after a unsuccessful Redirect still returns StatusCode SUCCESS.

    Version: CraftBukkit: #3108, Bukkit-Connect: #71, Client-Connect-API: #19, Go-Server-Connect: #32, Go-Server-Proxy: #79

    Reproduction of Bug: Executing the code below always prints "You are now at: 'xy'" to the Player.

    Code (java):

    try {
        FutureResult<RedirectResult> r = connect.request(new RedirectRequest(server, player.getName()));
        r.registerListener(new FutureResultListener<RedirectResult>() {
            public void onResult(RedirectResult result) {
                if(result.getStatusCode() == StatusCode.SUCCESS){
                    //I always end up here!
                    player.sendMessage(ChatColor.GREEN+"You are now at "+ChatColor.GRAY+server);
                player.sendMessage(ChatColor.RED+"Could not connect to server "+ChatColor.GRAY+server);

        return true;
    } catch (RequestException e) {
        player.sendMessage(ChatColor.RED+"Could not connect to server "+ChatColor.GRAY+server);
        return true;
    I need this to work :(
    Thank you for your time
    Last edited by a moderator: Aug 13, 2014
  2. flamin_scotsman

    flamin_scotsman New Member

    You initially have to understand that it is currently working as expected - as the returned result is that of the connect server, not of the proxy which handles the actual redirection of the player.

    Digging further down to the point where the redirect request is handled, the returned codes are:
    • INVALID_GENERIC: returned if there is no matching player
    • INVALID_ROLE: returned if the client has not authenticated with the connect server - not encountered when using bukkit-connect as authentication is handled automatically
    • SUCCESS: returned immediately after the redirect request has been forwarded to the proxy the player is using.
    The point in the connect server where this is handled can be found here.

    On the proxy side, on receipt of a redirect request, it looks up the player session, returning if there is no matching player, looks up the server from its name, again returning if there is no matching entry, and finally connects the player to the new server. Nowhere in this is any value returned to the connect server which would allow a more detailed result code.
    Last edited: Aug 11, 2014
    • Useful Useful x 1
  3. Superfuzzy

    Superfuzzy Member

    Thank you for the detailed explanation!
    I will still need to do a workaround . (If there is no other way to see if the redirect worked.. :()
    But at least I understand now what the RedirectResult is really for :D
  4. flamin_scotsman

    flamin_scotsman New Member

    Depends what you are wanting to achieve - if you just want to know if a player has teleported somewhere, just have a short delayed task to check if the player is still on the server - they will still be on the original server if the redirect failed.

    If you want to know if the server is still part of the network, and available for players to be redirected to, then you are going to want some sort of system for keeping the servers in sync - one method would be that which you suggested in the other thread. Your method does come with the caveat that a server may drop out of connectivity outside of server shutdowns, so while your internal server cache would show the server is available for redirects, the redirect would be rejected.

    If you wanted to know if a player actually arrived at the destination 'safely', you'd need to write some protocol on top of lilypad messages to either broadcast messages on player logins and compare if they login to the server you expected (wastes bandwidth and connect server capacity) or to announce to the destination server that they expect a certain player to arrive, and to report back when they arrive. Whether you need to be able to guarantee the redirect to this level is your call.
  5. Superfuzzy

    Superfuzzy Member

    Thanks again!
    I actually already thought of all these possibilities. And i think I'll still do the serversync because I can use it for other things as well.
  6. Coelho

    Coelho Software Engineer Staff Member Administrator Maintainer

    Perhaps we should revise this request so SUCCESS is only the result if the redirect actually succeeds.
    • Agree Agree x 1
  7. Superfuzzy

    Superfuzzy Member

Share This Page