mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-25 12:45:48 +01:00
Add server context to getPermissionValue calls.
This commit is contained in:
parent
1ac3ad932e
commit
cccb3c79d5
@ -567,7 +567,9 @@ public Set<Context> getGPContexts(ContextSet contextSet) {
|
||||
}
|
||||
|
||||
public Tristate getPermissionValue(GDPermissionHolder holder, String permission) {
|
||||
ImmutableContextSet set = ImmutableContextSet.empty();
|
||||
final Set<Context> contexts = new HashSet<>();
|
||||
this.checkServerContext(contexts);
|
||||
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
|
||||
return this.getPermissionValue(holder, permission, set);
|
||||
}
|
||||
|
||||
@ -578,13 +580,16 @@ public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, Str
|
||||
|
||||
public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts) {
|
||||
this.addActiveContexts(contexts, holder, null, claim);
|
||||
return this.getPermissionValue(holder, permission, contexts);
|
||||
this.checkServerContext(contexts);
|
||||
ImmutableContextSet contextSet = this.getLPContexts(contexts).immutableCopy();
|
||||
return this.getPermissionValue(holder, permission, contextSet);
|
||||
}
|
||||
|
||||
public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts, boolean checkTransient) {
|
||||
final Set<Context> activeContexts = new HashSet<>();
|
||||
this.addActiveContexts(activeContexts, holder, null, claim);
|
||||
contexts.addAll(activeContexts);
|
||||
this.checkServerContext(contexts);
|
||||
final int contextHash = Objects.hash(claim, holder, permission, contexts);
|
||||
final Cache<Integer, Tristate> cache = PermissionHolderCache.getInstance().getOrCreatePermissionCache(holder);
|
||||
Tristate result = cache.getIfPresent(contextHash);
|
||||
@ -687,6 +692,8 @@ public Tristate getPermissionValueWithRequiredContexts(GDClaim claim, GDPermissi
|
||||
}
|
||||
|
||||
public Tristate getPermissionValue(GDPermissionHolder holder, String permission, Set<Context> contexts) {
|
||||
this.addActiveContexts(contexts, holder, null, null);
|
||||
this.checkServerContext(contexts);
|
||||
ImmutableContextSet contextSet = this.getLPContexts(contexts).immutableCopy();
|
||||
return this.getPermissionValue(holder, permission, contextSet);
|
||||
}
|
||||
|
@ -563,7 +563,9 @@ public Set<Context> getGPContexts(ContextSet contextSet) {
|
||||
}
|
||||
|
||||
public Tristate getPermissionValue(GDPermissionHolder holder, String permission) {
|
||||
ImmutableContextSet set = ImmutableContextSet.empty();
|
||||
final Set<Context> contexts = new HashSet<>();
|
||||
this.checkServerContext(contexts);
|
||||
ImmutableContextSet set = this.getLPContexts(contexts).immutableCopy();
|
||||
return this.getPermissionValue(holder, permission, set);
|
||||
}
|
||||
|
||||
@ -574,13 +576,16 @@ public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, Str
|
||||
|
||||
public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts) {
|
||||
this.addActiveContexts(contexts, holder, null, claim);
|
||||
return this.getPermissionValue(holder, permission, contexts);
|
||||
this.checkServerContext(contexts);
|
||||
ImmutableContextSet contextSet = this.getLPContexts(contexts).immutableCopy();
|
||||
return this.getPermissionValue(holder, permission, contextSet);
|
||||
}
|
||||
|
||||
public Tristate getPermissionValue(GDClaim claim, GDPermissionHolder holder, String permission, Set<Context> contexts, boolean checkTransient) {
|
||||
final Set<Context> activeContexts = new HashSet<>();
|
||||
this.addActiveContexts(activeContexts, holder, null, claim);
|
||||
contexts.addAll(activeContexts);
|
||||
this.checkServerContext(contexts);
|
||||
final int contextHash = Objects.hash(claim, holder, permission, contexts);
|
||||
final Cache<Integer, Tristate> cache = PermissionHolderCache.getInstance().getOrCreatePermissionCache(holder);
|
||||
Tristate result = cache.getIfPresent(contextHash);
|
||||
@ -683,6 +688,8 @@ public Tristate getPermissionValueWithRequiredContexts(GDClaim claim, GDPermissi
|
||||
}
|
||||
|
||||
public Tristate getPermissionValue(GDPermissionHolder holder, String permission, Set<Context> contexts) {
|
||||
this.addActiveContexts(contexts, holder, null, null);
|
||||
this.checkServerContext(contexts);
|
||||
ImmutableContextSet contextSet = this.getLPContexts(contexts).immutableCopy();
|
||||
return this.getPermissionValue(holder, permission, contextSet);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user