Test initialization of permission handlers in PermissionManager
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package fr.xephi.authme.permission;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.initialization.Reloadable;
|
||||
import fr.xephi.authme.listener.JoiningPlayer;
|
||||
@@ -41,8 +42,7 @@ public class PermissionsManager implements Reloadable {
|
||||
|
||||
private final Server server;
|
||||
private final PluginManager pluginManager;
|
||||
|
||||
private Settings settings;
|
||||
private final Settings settings;
|
||||
|
||||
/**
|
||||
* The permission handler that is currently in use.
|
||||
@@ -76,7 +76,8 @@ public class PermissionsManager implements Reloadable {
|
||||
* Setup and hook into the permissions systems.
|
||||
*/
|
||||
@PostConstruct
|
||||
private void setup() {
|
||||
@VisibleForTesting
|
||||
void setup() {
|
||||
if (settings.getProperty(PluginSettings.FORCE_VAULT_HOOK)) {
|
||||
try {
|
||||
PermissionHandler handler = createPermissionHandler(PermissionsSystemType.VAULT);
|
||||
|
||||
@@ -36,8 +36,7 @@ public class LuckPermsHandler implements PermissionHandler {
|
||||
try {
|
||||
luckPermsApi = LuckPerms.getApi();
|
||||
} catch (IllegalStateException e) {
|
||||
e.printStackTrace();
|
||||
throw new PermissionHandlerException("Could not get api of LuckPerms");
|
||||
throw new PermissionHandlerException("Could not get api of LuckPerms", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,4 +9,8 @@ public class PermissionHandlerException extends Exception {
|
||||
public PermissionHandlerException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public PermissionHandlerException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user