Delaying an event...

Discussion in 'Plugin Development' started by Pixelatorx2, Aug 3, 2014.

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

    Pixelatorx2

    Well, I cant put a title to it but essentially, I want to pause the login event.

    I wont disclose what exactly the goal of my project is, but what I will say is that what I am trying to do is unique, which is why I wont be posting the actual contents of the plugin.

    To go more in depth, I have a hashmap (lets call it "map"). In this "map" it contains playernames, and once a player in this map joins, I would like to delay the event, meaning they see the "connecting to server" screen for longer then it would take, lets say 10 seconds.

    Yes I have registered the event, yes the player is in the hashmap (I have a notification in the MOTD). The plugin is fully functional, except I need to work that out. I have used PlayerPreLoginEvent, PlayerLoginEvent and PlayerJoinEvent to no prevail. Using a delayed task doesnt work, it will A) not fire (for example using e.disallow()) or B) it doesnt delay the event.

    I'm not one to usually ask for help, but as you can see I really dont see any solution to this.
     
  2. Offline

    xTigerRebornx

    Pixelatorx2 AFAIK, you cannot delay the Players login, nor do I see a reason you'd want to do this.
    Providing your reasoning for such would help others suggest an alternative, as well as some background on what exactly you are trying to do.
     
  3. Offline

    Pixelatorx2

    xTigerRebornx
    *sigh*

    Essentially I am creating a new punishment, instead of banning, muting or kicking I am discouraging. When a player is "discouraged" they might "randomly" not be able to join the server. Making it so that you are stopped from joining immediately makes it seem fishy, I want it as smooth and as invisible as possible. I dont want them to know they are discouraged.

    And I thought so, but the cats out of the bag now.
     
  4. Offline

    xTigerRebornx

    Pixelatorx2 Could use protocol lib to block the outbound login packets, client would be waiting for a response and never get one.
     
  5. Offline

    Pixelatorx2

    Good idea, I'll see what I can do.
     
  6. Offline

    _LB

    Unfortunately the client has a built-in timeout when connecting. If it can't connect within a certain amount of time it automatically gives up. If it takes them most of this time to actually connect to the server in the first place, you delaying their login might push them over the limit.
     
  7. Offline

    Pixelatorx2

    _LB
    ;) As long as they dont look in the development console, you cant actually tell the difference between "connection timed out" and being kicked for "connection timed out" :p
     
  8. Offline

    fireblast709

    Pixelatorx2 just Thread.sleep() in the AsyncPlayerPreLoginEvent
     
  9. Offline

    Pixelatorx2

    fireblast709
    Would that work if multiple players login at the same time? I would assume the thread is already sleeping, but thanks this method does work.
     
  10. Offline

    _LB

    It will indeed result in players getting queued up because the entire login thread will hang.
     
  11. Offline

    fireblast709

    _LB likes this.
  12. Offline

    Pixelatorx2

  13. Offline

    _LB

  14. Offline

    Rocoty

    fireblast709 but that would still make the clients time out, wouldn't it?
     
  15. Offline

    fireblast709

    Rocoty if you go over the timeout (iirc 30 secs). Though I believe that was the idea
     
  16. Rocoty Yeah, since you can't sleep the client side :p
    Pixelatorx2 Out of interest, if they don't know they're being "discouraged", how does it "discourage" them?
     
  17. Offline

    fireblast709

    AdamQpzm timeouts all the time you try to connect, that's pretty discouraging on it's own
     
  18. Offline

    fireblast709

    AdamQpzm that's what I read in OP's second post :3
     
  19. fireblast709 Ah fair enough. Rereading it that makes sense now :)

    Pixelatorx2 Interesting idea, but have to say it's not really "unique" - a while ago a typo caused banned players clients to crash when trying to join my server. Can't remember what it was exactly, but I had some use in mind with packets but it just made them crash each time. I noticed the side effect that some people didn't realise they'd been banned :p Similar to your idea, but more obvious (and accidental). Would be surprised if nobody else has ever thought of a similar idea.
     
Thread Status:
Not open for further replies.

Share This Page