Respawn Delay

Discussion in 'Plugin Development' started by shades161, Jul 10, 2015.

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

    shades161

    So, I am running a minigames plugin on my server (not my plugin) and have ctf as one of my minigames. As per player request, they suggested adding respawn delays to the game. Now, I tried coding this by using the PlayerRespawnEvent and making it so they are invisible, blinded and can't move.

    However, there was about a second to 2 seconds before it actually kicked it when you respawned, even when there was absolutely no lag and on a test server, that had nothing else on it.

    So, I'm wondering, would it be better to use the PlayerDeathEvent and just add a delay to a player dying?
    Only concern I have with that is that the minigame plugin has all of its listeners set to highest priority, so I really don't know the best way to go about this here.
     
    Last edited: Jul 10, 2015
  2. Offline

    mythbusterma

    @shades161

    You can lower the priority of the listeners in your minigame. I would say the easiest way to add the delay would be to create a small box that Players are stuck in until you teleport them out, that would be the easiest I feel (as you could set their spawn point using PlayerRespawnEvent, and this wouldn't lag).
     
  3. Offline

    shades161

    @mythbusterma The minigame plugin isn't mine, and there's no option to lower the listener priority (if there was, I would have done that) but I'll see if I can do something like that
     
  4. Offline

    bazsi700

    @shades161 How about cancelling the respawn event until the given time? I'm not sure, that's just an idea.
     
  5. Offline

    shades161

    @bazsi700 tried that, you can't cancel that event.
     
  6. Offline

    Hyfuel

    Not 100% sure, but try adding a while loop with the event inside. If it works, set the while loop to false when needed, or keep it to true in the first place.
     
  7. Offline

    teej107

    That would lag the server for everybody each time someone is going to respawn
     
Thread Status:
Not open for further replies.

Share This Page