Minor refactor of permissions handlers

* Move `essentials.build` perm check from AntiBuild into default SuperPerms handler
* Don't emulate wildcards for LuckPerms or PEX
* Add `build: true` meta support for LuckPerms (+ other plugins as needed)
This commit is contained in:
md678685 2019-12-26 15:08:07 +00:00
parent 1c4ce7b4bd
commit 4ce7dfa8f0
5 changed files with 53 additions and 33 deletions

View file

@ -0,0 +1,26 @@
package com.earth2me.essentials.perm.impl;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.bukkit.entity.Player;
public class ModernVaultHandler extends AbstractVaultHandler {
private final List<String> supportedPlugins = Arrays.asList("PermissionsEx", "LuckPerms");
@Override
protected boolean emulateWildcards() {
return false;
}
@Override
public boolean canBuild(final Player base, final String group) {
Objects.requireNonNull(base, "Can't check build override for nonexistent player!");
return super.canBuild(base, group) || chat.getPlayerInfoBoolean(base.getWorld().getName(), base, "build", false);
}
@Override
public boolean tryProvider() {
return super.canLoad() && supportedPlugins.contains(getEnabledPermsPlugin());
}
}