Hello, I need infinity event that will be starts when player joins to the server. How can I create it?
Nothing runs forever, everything runs timed. What exactly are you looking for? In normal words, not in code.
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)
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.
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.
@RikiMaus Assuming the task is run and the player is whitelisted, try making the task synchronous instead of asynchronous.