Improve the way Vault lookups for offline players are handled (#1150)

1) The behaviour of online player lookups is unchanged - this only affects offline player data lookups.
2) If a 'offline player' request is made from an async task, it is executed normally. (the data is loaded)
3) If a 'offline player' request that cannot be immediately fulfilled is made from the main server thread, an exception is thrown.

The exception thrown as a result of 3) can be disabled in the config. In this case, the query is performed anyway. The main server thread will block until the request is complete.
This commit is contained in:
Luck
2018-08-11 19:02:57 +01:00
Unverified
parent 56df15caf8
commit 56c55d71fe
6 changed files with 329 additions and 370 deletions
@@ -321,6 +321,11 @@ public final class ConfigKeys {
*/
public static final ConfigKey<Boolean> COMMANDS_ALLOW_OP = EnduringKey.wrap(BooleanKey.of("commands-allow-op", true));
/**
* If Vault lookups for offline players on the main server thread should be enabled
*/
public static final ConfigKey<Boolean> VAULT_UNSAFE_LOOKUPS = BooleanKey.of("vault-unsafe-lookups", false);
/**
* If the vault server option should be used
*/