Fix regions
This commit is contained in:
1 parent
4ab18417be
commit
410aaf1eb7
3 files changed
+34
-26
No files matched your search
+2
-2
@@ -7,8 +7,8 @@ import java.util.List;
|
||||
|
||||
public class RegionSettings extends OkaeriConfig {
|
||||
@Comment({
|
||||
"# List of regions where combat is restricted.",
|
||||
"# Players in these regions will not be able to engage in combat."
|
||||
"# Regions that combat-tagged players may not enter, even where the pvp flag allows PvP.",
|
||||
"# A higher-priority region that explicitly allows PvP still wins over a listed region."
|
||||
})
|
||||
public List<String> blockedRegions = Collections.singletonList("your_region");
|
||||
|
||||
|
||||
+18
-10
@@ -86,19 +86,27 @@ public class WorldGuardRegionProvider implements RegionProvider {
|
||||
return true;
|
||||
}
|
||||
|
||||
// A region in the blockedRegions list applies here, but never treat a spot as restricted when
|
||||
// a higher-priority region explicitly allows PvP. Otherwise a large umbrella region (e.g. a
|
||||
// world-spanning "spawn" listed in blockedRegions) would also block the warzone/arenas nested
|
||||
// inside it.
|
||||
if (pvpState != StateFlag.State.ALLOW) {
|
||||
for (ProtectedRegion region : applicableRegions.getRegions()) {
|
||||
if (this.regions.contains(region.getId())) {
|
||||
return true;
|
||||
}
|
||||
// A listed region restricts this spot unless a higher-priority region explicitly allows
|
||||
// PvP. A listed umbrella region (a world-spanning "spawn") therefore never blocks the
|
||||
// warzone nested inside it, while a listed arena outranks the warzone it sits in.
|
||||
int listedPriority = Integer.MIN_VALUE;
|
||||
for (ProtectedRegion region : applicableRegions.getRegions()) {
|
||||
if (this.regions.contains(region.getId())) {
|
||||
listedPriority = Math.max(listedPriority, region.getPriority());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (listedPriority == Integer.MIN_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ProtectedRegion region : applicableRegions.getRegions()) {
|
||||
if (region.getPriority() > listedPriority && region.getFlag(Flags.PVP) == StateFlag.State.ALLOW) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Per-region check used only for border rendering, where there is no single query point.
|
||||
|
||||
@@ -246,23 +246,23 @@ admin:
|
||||
# Settings related to regions.
|
||||
# Configure region-specific settings and behaviors for combat.
|
||||
regions:
|
||||
# List of regions where combat is restricted.
|
||||
# Players in these regions will not be able to engage in combat.
|
||||
# Regions that combat-tagged players may not enter, even where the pvp flag allows PvP.
|
||||
# A higher-priority region that explicitly allows PvP still wins over a listed region.
|
||||
blockedRegions:
|
||||
- spawn
|
||||
- market
|
||||
- colosseum
|
||||
- atlantis
|
||||
- olympus
|
||||
- ender
|
||||
- cave
|
||||
- blizzard
|
||||
- fungi
|
||||
- hell
|
||||
- castle
|
||||
- frozone
|
||||
- sewer
|
||||
- chasm
|
||||
- arena-colosseum
|
||||
- arena-atlantis
|
||||
- arena-olympus
|
||||
- arena-ender
|
||||
- arena-cave
|
||||
- arena-blizzard
|
||||
- arena-fungi
|
||||
- arena-hell
|
||||
- arena-castle
|
||||
- arena-frozone
|
||||
- arena-sewer
|
||||
- arena-chasm
|
||||
# Prevent players from entering regions where PVP is disabled by WorldGuard.
|
||||
# Set to 'true' to enforce this restriction, or 'false' to allow PVP in all regions.
|
||||
preventPvpInRegions: true
|
||||
|
||||
Reference in new issue
Block a user