Event

Discussion in 'Plugin Development' started by RikiMaus, Jul 28, 2024.

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

    RikiMaus

    Hello, I need infinity event that will be starts when player joins to the server. How can I create it?
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    RikiMaus

    I think it's runnable that starts when it reaches a certain event
     
  4. Offline

    timtower Administrator Administrator Moderator

    Nothing runs forever, everything runs timed.
    What exactly are you looking for? In normal words, not in code.
     
  5. Offline

    RikiMaus

    I have code that writes players to the database and I need to create a check if the player is NOT in the whitelist then it removes from the database (this check should always happen so that after the command /whitelist remove <player> the player will be immediately removed from whitelist)
     
  6. Offline

    timtower Administrator Administrator Moderator

    Doesn't this trigger a PlayerLeaveEvent or a kick?
    If so: just listen to that
     
  7. Offline

    KarimAKL

    I don't believe it does. I think it just denies access upon login.

    @RikiMaus You could listen for the command event or check the whitelist periodically using a runnable. Alternatively, if you handle the whitelist command yourself, you can do it there.
     
  8. Offline

    timtower Administrator Administrator Moderator

    Worth a test from the developer
     
    KarimAKL likes this.
  9. Offline

    RikiMaus

    upload_2024-7-29_8-9-31.png I have this. If I will use Runnable I need create it in main class?
     

    Attached Files:

  10. Offline

    KarimAKL

    To run a BukkitRunnable, you would have to pass it your plugin's main class instance, yes, but it doesn't need to be in the main class specifically. Did you try timtower's suggestion for listening to the quit or kick event? Making it event-based would be preferable to a runnable.
     
  11. Offline

    RikiMaus

    upload_2024-7-29_20-31-23.png Why player.sendMessage("ADDED") isn't working?
     
  12. Offline

    KarimAKL

    @RikiMaus Assuming the task is run and the player is whitelisted, try making the task synchronous instead of asynchronous.
     
  13. Offline

    timtower Administrator Administrator Moderator

    @RikiMaus Not to mention: that only runs once, when the plugin starts.
     
Thread Status:
Not open for further replies.

Share This Page