Solved "Resending" A PlayerJoinEvent

Discussion in 'Plugin Development' started by Lightcaster5, Mar 12, 2020.

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

    Lightcaster5

    I'm currently trying to create a queue plugin, similar to 2b2t's, and I have most of the logic figured out and already made but I don't know what to do when a player has reached the end and is getting ready to start playing. I was wondering if I could somehow store the location they needed to get to but then I wondered if there was a way I could "resend" a playerJoinEvent so the server could then do whatever they wanted with the player. Is this even possible or is there a different approach I should take?
     
  2. I'm not sure, but couldn't you just do
    Code:
    @EventHandler(priority = EventPriority.HIGHEST)
    ? Then you can cancel the event if they're not allowed to join, and the other join events, which have a lower priority, will execute if you do not cancel the event.
     
  3. Offline

    KarimAKL

    @Lightcaster5 Try this:
    Code:Java
    1. Bukkit.getPluginManager().callEvent(new PlayerJoinEvent(player, null));


    Also, there's probably a better way to do what you want, although i didn't quite understand what you wanted to do, could you try to rephrase it or something?
     
  4. Offline

    robertlit

    If you want to call an event the method shown above is the way to do it.
    I can't understand one thing, though, the queue server is a different server then the playing server (or isn't it?), so when sending the player from the queue to the actual server, the event would be called anyway, so why call it again?
     
  5. Offline

    Lightcaster5

    Okay, I understand the confusion. I'm trying to make a queue plugin to sell on bukkit.org/spigotmc.org/mc-market.org so it is a necessary feature. Is it possible to halt all plugins from using a player join event until they leave the queue (join the actual world)? Let's say a plugin creates a scoreboard, the queue plugin should somehow pause the initial player join listener that it probably uses and then when the player reaches the front of the line and finally joins after waiting, the event is played through and the other plugins can do their thing.
     
  6. Offline

    Sensevx

    @Lightcaster5
    Maybe process the player on PlayerLoginEvent and PlayerPreLoginEvent that's before PlayerJoinEvent
     
  7. Offline

    Lightcaster5

    Do you know how I could go about using those to pause other plugins from receiving the PlayerJoinEvent until they are out of the queue
     
  8. Offline

    Sensevx

    @Lightcaster5

    PlayerLoginEvent is called before PlayerJoinEvent, halt them in PlayerLoginEvent so PlayerJoinEvent won't be called until the player is next in queue.
     
  9. Offline

    KarimAKL

    @Lightcaster5 I don't think there's any way to stop the PlayerJoinEvent from getting called while still letting them join the server.

    Why do you want to use the PlayerJoinEvent for this?
     
  10. Offline

    Kars

    2b2t has a seperate world in which queued players reside. When their turn comes, they are spawned into the actual world.
    Your approach sounds uninformed to me.
     
  11. Offline

    Lightcaster5

    I completely understand the functioning behind 2b2t's plugin... As I have said on this thread (scroll up), I wanted to publish this for people to use on their servers. It would function the same but I was wondering if it was possible to halt all player join events from any other plugin until the player has finished their time in a queue.
     
  12. Offline

    KarimAKL

    Probably not, at least without some hacky way.
     
  13. Offline

    Lightcaster5

    Thanks for the support but I think I will make the ones interested VERY WELL AWARE that this plugin may conflict with other plugins and was intended for use in anarchy servers that need player count managed
    @timtower can you close this thread, the problem isn't solvable in a reasonable way and I have moved on from the problem itself. Thanks.
     
  14. Offline

    timtower Administrator Administrator Moderator

    Don't tag me for moderation tasks.
    Mark the thread as solved instead.
    Lock will happen on its own.
     
  15. Offline

    Lightcaster5

    Alright, thanks. Sorry for the tag.
     
Thread Status:
Not open for further replies.

Share This Page