mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-15 07:05:32 +01:00
Add configurable announcement for current bypass status
This commit is contained in:
parent
ad000ab051
commit
136ec31f38
@ -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<>();
|
||||
|
@ -175,6 +175,7 @@ public abstract class WorldConfiguration {
|
||||
public boolean breakDeniedHoppers;
|
||||
public boolean useMaxPriorityAssociation;
|
||||
public boolean disableDefaultBypass;
|
||||
public boolean announceBypassStatus;
|
||||
protected Map<String, Integer> maxRegionCounts;
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user