Can it be done? An Odd Request.

Discussion in 'Plugin Development' started by danslayerx, Jun 27, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Minecrell

    RainoBoy97
    Well... I don't think so, because I didn't test the lib :p
    Do you have ProtocolLib on your server? And add it to (soft)depend in your plugin.yml ;)
    Edit: Ah and you have to change the snapshot version to something high, else you won't get the Server version displayed because the clients thinks he has the right version ;)

    RainoBoy97
    The API / lib still needs some improvements, but I didn't found enough time to add some new features yesterday.
    And please: Do not use it to fake online players on a production server.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  2. Offline

    RainoBoy97

    Minecrell
    Ok, will test again.. And no, I won't use this to fake online players.
     
  3. Offline

    Minecrell

    RainoBoy97
    I test it myself as soon as I finished adding something to my command lib ;)
     
  4. Offline

    RainoBoy97

    Minecrell
    Okay, cool!
    Still doens't work :c
     
  5. Offline

    Minecrell

    RainoBoy97
    Yep, now I remember the problem of it :p
    I don't know if it's a bug of ProtocolLib, but it doesn't work with CraftBukkit without adding a debug listener to the packet. (Type /packet add server 255 in the console) If you're using Spigot everything works normal.
    I don't know if MP5K has found a solution for that.
    Fixed that. (See below)
    Edit: Tagging Comphenix, maybe he knows why you have to add it if you use CraftBukkit :p

    RainoBoy97
    Without the debug listener thing, and that it doesn't work without ProtocolLib at the moment (so you can only use motd and max players), the API is working great for me.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  6. Offline

    Comphenix

    That's because you're attempting to intercept a login packet (code is outdated though), which requires you to register a listener with GamePhase.LOGIN:
    So you just have to add GamePhase.LOGIN to your ServerListPacketAdapter constructor.

    To be fair, the API for this feature is a bit confusing and not that well documented. But I don't think it necessary should be easy either ...
     
    Minecrell likes this.
  7. Offline

    Minecrell

    Sorry, didn't read that, wrote this code with ProtocolLib 2.3.0, and already wondered why I doesn't work anymore, thanks. Fixed that.
    Why is the code outdated? (Without the GamePhase thing)
    Just posted that here because someone was asking for the code how he can do that. I haven't work much on it, and as already stated, I haven't finished it.
     
  8. Offline

    Comphenix

    Oh, I meant the example code I linked to - it uses \u00A7 as delimiter instead of \0 and a slightly different parameter list, as it was written for 1.2.5 (or 1.3.2, can't remember exactly). Your version works fine on 1.5.2, on the other hand. :)
     
    Minecrell likes this.
  9. Offline

    Minecrell

    Comphenix
    When I cancel the server list ping packet the console gets spammed with one "Connection reset" message per server list refresh. Do you have an idea how to prevent that?
     
  10. Offline

    Comphenix

    Hm, I get /127.0.0.1:64917 lost connection.

    But there's generally two methods to prevent the message from being written.
    1. Search for the message itself in the source code, and find a way to disable that part of the code through reflection (class loader hacks are not permitted).
    2. Add a Filter to the default Minecraft logger, preventing such messages from being printed for a period of time after cancellation.
     
    Minecrell likes this.
  11. Offline

    RainoBoy97

    Minecrell
    Got it to work :D
    Changed from
    Code:
    super(ServerListAPI.this.plugin, ConnectionSide.SERVER_SIDE, ListenerPriority.LOWEST, Packets.Server.KICK_DISCONNECT);
    
    to
    Code:
    super(ServerListAPI.this.plugin, ConnectionSide.SERVER_SIDE, ListenerPriority.LOWEST, GamePhase.LOGIN, Packets.Server.KICK_DISCONNECT);
    
    Works perfectly now! =D
     
    Minecrell likes this.
  12. Offline

    Minecrell

    RainoBoy97
    Or just download the updated version ;)
     
    RainoBoy97 likes this.
  13. Offline

    RainoBoy97

    Minecrell
    Just did, it's awesome :D

    Is it possible that I code a private mod to allow "staff" to login?
     
  14. Offline

    Minecrell

    So they can click on Join Server if you change the Server version?
     
  15. Offline

    Ivan

    Whitelist it lol
     
  16. Offline

    RainoBoy97

    Yes :)
     
  17. Offline

    Minecrell

    Well they could use Direct Connect, or you would have to create a mod that accepts a custom snapshot version as a valid version too. (So it is not displayed as Client out of date or Server out of date)
     
  18. Offline

    Comphenix

    You could also check their IP address and disable the modification if it is contained in a whitelist.
     
  19. Offline

    Minecrell

    That only works if they have a static IP address ;)
     
Thread Status:
Not open for further replies.

Share This Page