mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-28 05:25:20 +01:00
Added the ability to add owners/members to the global region for handling guest groups.
This commit is contained in:
parent
3b871b9c00
commit
360a655627
@ -164,7 +164,13 @@ private boolean internalGetState(StateFlag flag, LocalPlayer player,
|
|||||||
|
|
||||||
// The global region has this flag set
|
// The global region has this flag set
|
||||||
if (globalState != null) {
|
if (globalState != null) {
|
||||||
def = (globalState == State.ALLOW);
|
// Special case for the build flag
|
||||||
|
if (player != null && globalRegion.hasMembersOrOwners()) {
|
||||||
|
def = globalRegion.isMember(player)
|
||||||
|
? (globalState == State.ALLOW) : false;
|
||||||
|
} else {
|
||||||
|
def = (globalState == State.ALLOW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,6 @@ public void setOwners(DefaultDomain owners) {
|
|||||||
* @return the members
|
* @return the members
|
||||||
*/
|
*/
|
||||||
public DefaultDomain getMembers() {
|
public DefaultDomain getMembers() {
|
||||||
|
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,11 +178,20 @@ public void setMembers(DefaultDomain members) {
|
|||||||
this.members = members;
|
this.members = members;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether a region has members or owners.
|
||||||
|
*
|
||||||
|
* @return whether there are members or owners
|
||||||
|
*/
|
||||||
|
public boolean hasMembersOrOwners() {
|
||||||
|
return owners.size() > 0 || members.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a player is an owner of region or any of its parents.
|
* Checks whether a player is an owner of region or any of its parents.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player player to check
|
||||||
* @return
|
* @return whether an owner
|
||||||
*/
|
*/
|
||||||
public boolean isOwner(LocalPlayer player) {
|
public boolean isOwner(LocalPlayer player) {
|
||||||
if (owners.contains(player)) {
|
if (owners.contains(player)) {
|
||||||
@ -202,12 +210,12 @@ public boolean isOwner(LocalPlayer player) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a player is a member of the region or any of its parents.
|
* Checks whether a player is a member OR OWNER of the region
|
||||||
|
* or any of its parents.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player player to check
|
||||||
* @return
|
* @return whether an owner or member
|
||||||
*/
|
*/
|
||||||
public boolean isMember(LocalPlayer player) {
|
public boolean isMember(LocalPlayer player) {
|
||||||
if (owners.contains(player) || members.contains(player)) {
|
if (owners.contains(player) || members.contains(player)) {
|
||||||
@ -227,6 +235,30 @@ public boolean isMember(LocalPlayer player) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether a player is a member of the region
|
||||||
|
* or any of its parents.
|
||||||
|
*
|
||||||
|
* @param player player to check
|
||||||
|
* @return whether an member
|
||||||
|
*/
|
||||||
|
public boolean isMemberOnly(LocalPlayer player) {
|
||||||
|
if (members.contains(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProtectedRegion curParent = getParent();
|
||||||
|
while (curParent != null) {
|
||||||
|
if (curParent.getMembers().contains(player)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
curParent = curParent.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a flag's value.
|
* Get a flag's value.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user