Players are loaded 5 seconds after join
Zettelkasten opened this issue ยท 6 comments
According to https://github.com/games647/McCombatLevel/blob/master/src/main/java/com/gmail/mrphpfan/mccombatlevel/PlayerListener.java#L38, players are loaded 5 seconds after they have joined as the server.
This makes it really difficult for other plugins to use the combat level right after a player has joined. Is there a way of fixing this? I don't know any of the UserManager and other McMMO API, but this would be great.
I know this is kinda late but I just want to let you guys know that you both are AWESOME!!!
The player data from mcMMO are fetched async on joins, because especially SQL operations pauses the thread until they receive a response. Therefore I implemented a delay loading with the hope the data is loaded then.
I get that. It is a really bad practice though. You should listen to some sort of event, or, if there is none, you could do something like that: Create a repeating task that runs until the player is loaded.
The problem I am having is that I need to wait for your plugin to load the player.
Yes I already check the mcMMO, but there is really no event for it.
you could do something like that: Create a repeating task that runs until the player is loaded.
Yes, that would be a better idea.
Maybe loaded event could be implemented in McCombatLevel instead.
Just to let you know that PlayerCombatLevelChangeEvent is also called on profile load. As you correctly said in the documentation the old value is just '-1'
@games647 Oh, I completely forgot about that. Thanks for letting me know.
I changed my whole plugin to use async method calls now, and therefore I can just wait for your plugin and McMMO.