Hello, I am making a guard plugin, and I need to know if I am using completablefutures in the most efficient way / the correct way.
The following code is from a command which fires guards, it handles both online and offline players. The tricky bit is when the player is offline, because it involves multiple heavy tasks that needs to be performed asynchronously away from the main thread. I've tested the code, and it does work, I am just interested in knowing if it is the best way to chain multiple completablefutures together.
(I've added some comments explaining what the code does)
gist.github.com
Hopefully someone with more experience can tell me if this is how you would chain multiple completablefutures together, or if there is just something that could be better about my code in general
The following code is from a command which fires guards, it handles both online and offline players. The tricky bit is when the player is offline, because it involves multiple heavy tasks that needs to be performed asynchronously away from the main thread. I've tested the code, and it does work, I am just interested in knowing if it is the best way to chain multiple completablefutures together.
(I've added some comments explaining what the code does)

gist:423ad4fbb9eb418bcdfaf7d7dcf6325c
GitHub Gist: instantly share code, notes, and snippets.
Hopefully someone with more experience can tell me if this is how you would chain multiple completablefutures together, or if there is just something that could be better about my code in general