diff --git a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java index 29433d45..0beb2f48 100644 --- a/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java +++ b/worldguard-bukkit/src/main/java/com/sk89q/worldguard/bukkit/BukkitWorldConfiguration.java @@ -281,6 +281,7 @@ public void loadConfiguration() { claimOnlyInsideExistingRegions = getBoolean("regions.claim-only-inside-existing-regions", false); boundedLocationFlags = getBoolean("regions.location-flags-only-inside-regions", false); disableDefaultBypass = getBoolean("regions.disable-bypass-by-default", false); + announceBypassStatus = getBoolean("regions.announce-bypass-status", false); maxRegionCountPerPlayer = getInt("regions.max-region-count-per-player.default", 7); maxRegionCounts = new HashMap<>(); diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java b/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java index 08384117..6fe1f6e8 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/config/WorldConfiguration.java @@ -175,6 +175,7 @@ public abstract class WorldConfiguration { public boolean breakDeniedHoppers; public boolean useMaxPriorityAssociation; public boolean disableDefaultBypass; + public boolean announceBypassStatus; protected Map maxRegionCounts; /** diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/session/Session.java b/worldguard-core/src/main/java/com/sk89q/worldguard/session/Session.java index ed90aa59..f297ba70 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/session/Session.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/session/Session.java @@ -22,8 +22,11 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.formatting.text.TextComponent; +import com.sk89q.worldedit.util.formatting.text.format.TextColor; import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.WorldGuard; +import com.sk89q.worldguard.config.WorldConfiguration; import com.sk89q.worldguard.protection.ApplicableRegionSet; import com.sk89q.worldguard.protection.flags.StateFlag.State; import com.sk89q.worldguard.protection.regions.ProtectedRegion; @@ -103,8 +106,14 @@ public void initialize(LocalPlayer player) { lastValid = location; lastRegionSet = set.getRegions(); - disableBypass = WorldGuard.getInstance().getPlatform().getGlobalStateManager() - .get(player.getWorld()).disableDefaultBypass; + WorldConfiguration cfg = WorldGuard.getInstance().getPlatform().getGlobalStateManager().get(player.getWorld()); + disableBypass = cfg.disableDefaultBypass; + if (cfg.announceBypassStatus && player.hasPermission("worldguard.region.toggle-bypass")) { + player.printInfo(TextComponent.of( + "You are " + (disableBypass ? "not" : "") + " bypassing region protection. " + + "You can toggle this with /rg bypass", TextColor.DARK_PURPLE)); + } + for (Handler handler : handlers.values()) { handler.initialize(player, location, set);