Question Chaining completablefutures together

AggerTV

New member
Sep 27, 2023
7
0
1
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)

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 :)