Fixed admin switch command when inside another island.

This commit is contained in:
tastybento 2021-02-07 10:05:29 -08:00
parent 2886c1ec21
commit ce79588805
2 changed files with 6 additions and 2 deletions

View File

@ -13,6 +13,8 @@ import world.bentobox.bentobox.api.user.User;
*/
public class AdminSwitchCommand extends ConfirmableCommand {
public static final String META_TAG = "AdminCommandSwitch";
/**
* Switches bypass on and off
* @param parent - admin command

View File

@ -13,6 +13,7 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.commands.admin.AdminSwitchCommand;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.metadata.MetaDataValue;
import world.bentobox.bentobox.api.user.User;
@ -153,7 +154,7 @@ public abstract class FlagListener implements Listener {
// Protection flag
// Ops or "bypass everywhere" moderators can do anything unless they have switched it off
if (!user.getMetaData("AdminCommandSwitch").map(MetaDataValue::asBoolean).orElse(false)
if (!user.getMetaData(AdminSwitchCommand.META_TAG).map(MetaDataValue::asBoolean).orElse(false)
&& (user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + "mod.bypassprotect")
|| user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + "mod.bypass." + flag.getID() + ".everywhere"))) {
if (user.isOp()) {
@ -183,7 +184,8 @@ public abstract class FlagListener implements Listener {
if (island.get().isAllowed(user, flag)) {
report(user, e, loc, flag, Why.RANK_ALLOWED);
return true;
} else if (user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + "mod.bypass." + flag.getID() + ".island")) {
} else if (!user.getMetaData(AdminSwitchCommand.META_TAG).map(MetaDataValue::asBoolean).orElse(false)
&& (user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + "mod.bypass." + flag.getID() + ".island"))) {
report(user, e, loc, flag, Why.BYPASS_ISLAND);
return true;
}