Allow default flags to be removed in claim tab by admins.

This commit is contained in:
bloodshot 2020-05-07 00:48:55 -04:00
parent 973c45d1ee
commit d6b2958580
2 changed files with 8 additions and 4 deletions

View File

@ -1147,11 +1147,13 @@ private Consumer<CommandSender> createFlagConsumer(GDPermissionUser src, GDClaim
// Check server context
final Iterator<Context> iterator = newContexts.iterator();
boolean hasServerContext = false;
boolean hasDefaultContext = false;
while (iterator.hasNext()) {
final Context context = iterator.next();
if (context.getKey().equals("server")) {
hasServerContext = true;
break;
} else if (context.getKey().equalsIgnoreCase("gd_claim_default")) {
hasDefaultContext = true;
}
}
@ -1166,7 +1168,7 @@ private Consumer<CommandSender> createFlagConsumer(GDPermissionUser src, GDClaim
return;
}
if (displayType == MenuType.DEFAULT) {
if (displayType == MenuType.DEFAULT || (hasDefaultContext && src.getInternalPlayerData().canManageFlagDefaults)) {
PermissionResult result = PermissionUtil.getInstance().setTransientPermission(this.subject, flag.getPermission(), newValue, newContexts);
if (result.successful()) {
showFlagPermissions(src, claim, displayType);

View File

@ -1147,11 +1147,13 @@ private Consumer<CommandSource> createFlagConsumer(GDPermissionUser src, GDClaim
// Check server context
final Iterator<Context> iterator = newContexts.iterator();
boolean hasServerContext = false;
boolean hasDefaultContext = false;
while (iterator.hasNext()) {
final Context context = iterator.next();
if (context.getKey().equals("server")) {
hasServerContext = true;
break;
} else if (context.getKey().equalsIgnoreCase("gd_claim_default")) {
hasDefaultContext = true;
}
}
@ -1166,7 +1168,7 @@ private Consumer<CommandSource> createFlagConsumer(GDPermissionUser src, GDClaim
return;
}
if (displayType == MenuType.DEFAULT) {
if (displayType == MenuType.DEFAULT || (hasDefaultContext && src.getInternalPlayerData().canManageFlagDefaults)) {
PermissionResult result = PermissionUtil.getInstance().setTransientPermission(this.subject, flag.getPermission(), newValue, newContexts);
if (result.successful()) {
showFlagPermissions(src, claim, displayType);