Don't purge users if unable to load permission data
This commit is contained in:
@@ -189,22 +189,21 @@ public class LuckPermsHandler implements PermissionHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUserData(UUID uuid) {
|
||||
public void loadUserData(UUID uuid) throws PermissionLoadUserException {
|
||||
try {
|
||||
luckPermsApi.getUserManager().loadUser(uuid).get(5, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||
e.printStackTrace();
|
||||
throw new PermissionLoadUserException("Unable to load the permission data of the user " + uuid, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUserData(String name) {
|
||||
public void loadUserData(String name) throws PermissionLoadUserException {
|
||||
try {
|
||||
UUID uuid = luckPermsApi.getStorage().getUUID(name).get(5, TimeUnit.SECONDS);
|
||||
loadUserData(uuid);
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||
e.printStackTrace();
|
||||
throw new PermissionLoadUserException("Unable to load the permission data of the user " + name, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -107,10 +107,9 @@ public interface PermissionHandler {
|
||||
*/
|
||||
PermissionsSystemType getPermissionSystem();
|
||||
|
||||
default void loadUserData(UUID uuid) {
|
||||
default void loadUserData(UUID uuid) throws PermissionLoadUserException {
|
||||
}
|
||||
|
||||
default void loadUserData(String name) {
|
||||
default void loadUserData(String name) throws PermissionLoadUserException {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package fr.xephi.authme.permission.handlers;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Exception thrown when a {@link PermissionHandler#loadUserData(UUID uuid)} request fails.
|
||||
*/
|
||||
public class PermissionLoadUserException extends Exception {
|
||||
|
||||
public PermissionLoadUserException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user