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.
|
* 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
|
* @param flag flag to check
|
||||||
* @return whether it is allowed
|
* @return whether it is allowed
|
||||||
* @throws IllegalArgumentException if the build flag is given
|
* @throws IllegalArgumentException if the build flag is given
|
||||||
@ -161,16 +160,20 @@ private boolean internalGetState(StateFlag flag, LocalPlayer player,
|
|||||||
// Handle defaults
|
// Handle defaults
|
||||||
if (globalRegion != null) {
|
if (globalRegion != null) {
|
||||||
State globalState = globalRegion.getFlag(flag);
|
State globalState = globalRegion.getFlag(flag);
|
||||||
|
|
||||||
// The global region has this flag set
|
// The global region has this flag set
|
||||||
if (globalState != null) {
|
if (globalState != null) {
|
||||||
// Special case for the build flag
|
// Build flag is very special
|
||||||
if (player != null && globalRegion.hasMembersOrOwners()) {
|
if (player != null && globalRegion.hasMembersOrOwners()) {
|
||||||
def = globalRegion.isMember(player)
|
def = globalRegion.isMember(player) && (globalState == State.ALLOW);
|
||||||
? (globalState == State.ALLOW) : false;
|
|
||||||
} else {
|
} else {
|
||||||
def = (globalState == State.ALLOW);
|
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
|
// on membership, so we have to check for parent-child
|
||||||
// relationships
|
// relationships
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
hasFlagDefined = true;
|
||||||
|
|
||||||
if (hasCleared.contains(region)) {
|
if (hasCleared.contains(region)) {
|
||||||
// Already cleared, so do nothing
|
// Already cleared, so do nothing
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user