mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 10:37:41 +01:00
Fixed some flag algorithm issues, added the possibility of owners and members on the global region in order to affect build.
This commit is contained in:
parent
a31476251e
commit
df8fdd086b
@ -81,7 +81,6 @@ public boolean canUse(LocalPlayer player) {
|
||||
/**
|
||||
* Gets the state of a state flag. This cannot be used for the build flag.
|
||||
*
|
||||
* @see #allows(com.sk89q.worldguard.protection.flags.StateFlag, com.sk89q.worldguard.LocalPlayer)
|
||||
* @param flag flag to check
|
||||
* @return whether it is allowed
|
||||
* @throws IllegalArgumentException if the build flag is given
|
||||
@ -164,13 +163,17 @@ private boolean internalGetState(StateFlag flag, LocalPlayer player,
|
||||
|
||||
// The global region has this flag set
|
||||
if (globalState != null) {
|
||||
// Special case for the build flag
|
||||
// Build flag is very special
|
||||
if (player != null && globalRegion.hasMembersOrOwners()) {
|
||||
def = globalRegion.isMember(player)
|
||||
? (globalState == State.ALLOW) : false;
|
||||
def = globalRegion.isMember(player) && (globalState == State.ALLOW);
|
||||
} else {
|
||||
def = (globalState == State.ALLOW);
|
||||
}
|
||||
} else {
|
||||
// Build flag is very special
|
||||
if (player != null && globalRegion.hasMembersOrOwners()) {
|
||||
def = globalRegion.isMember(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,6 +255,8 @@ private boolean internalGetState(StateFlag flag, LocalPlayer player,
|
||||
// on membership, so we have to check for parent-child
|
||||
// relationships
|
||||
if (player != null) {
|
||||
hasFlagDefined = true;
|
||||
|
||||
if (hasCleared.contains(region)) {
|
||||
// Already cleared, so do nothing
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user