Skip to content

Commit

Permalink
Move /rg bypass perm check inside the command.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wizjany committed Nov 17, 2020
1 parent 48233c3 commit 3879772
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1125,9 +1125,11 @@ public void teleport(CommandContext args, Actor sender) throws CommandException

@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);
Expand Down

0 comments on commit 3879772

Please sign in to comment.