Skip to content

Commit

Permalink
Fixed admin switch command when inside another island.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Feb 7, 2021
1 parent 2886c1e commit ce79588
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*/
public class AdminSwitchCommand extends ConfirmableCommand {

public static final String META_TAG = "AdminCommandSwitch";

/**
* Switches bypass on and off
* @param parent - admin command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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;
Expand Down Expand Up @@ -153,7 +154,7 @@ public boolean checkIsland(@NonNull Event e, @Nullable Player player, @Nullable
// 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()) {
Expand Down Expand Up @@ -183,7 +184,8 @@ public boolean checkIsland(@NonNull Event e, @Nullable Player player, @Nullable
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;
}
Expand Down

0 comments on commit ce79588

Please sign in to comment.