Move /rg bypass perm check inside the command.

Using @CommandPermissions would cause the root command to be excluded
from the client. This is a temp workaround until piston/proper perms
are somehow implemented.
This commit is contained in:
wizjany 2020-11-17 16:36:36 -05:00
parent 48233c3327
commit 3879772103
1 changed files with 3 additions and 1 deletions

View File

@ -1125,9 +1125,11 @@ public final class RegionCommands extends RegionCommandsBase {
@Command(aliases = {"toggle-bypass", "bypass"},
desc = "Toggle region bypassing, effectively ignoring bypass permissions.")
@CommandPermissions({"worldguard.region.toggle-bypass"})
public void toggleBypass(CommandContext args, Actor sender) throws CommandException {
LocalPlayer player = worldGuard.checkPlayer(sender);
if (!player.hasPermission("worldguard.region.toggle-bypass")) {
throw new CommandPermissionsException();
}
Session session = WorldGuard.getInstance().getPlatform().getSessionManager().get(player);
if (session.hasBypassDisabled()) {
session.setBypassDisabled(false);