mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-25 12:45:48 +01:00
Fix world permission checks.
* Ignore item frames during entity-chunk-spawn checks.
This commit is contained in:
parent
4433d9c2f3
commit
3a8de49049
@ -126,6 +126,7 @@ public class GDClaim implements Claim {
|
||||
// Permission Context
|
||||
private final Context context;
|
||||
private final Context overrideClaimContext;
|
||||
private final Context worldContext;
|
||||
|
||||
private UUID id = null;
|
||||
private UUID ownerUniqueId;
|
||||
@ -167,6 +168,7 @@ public GDClaim(World world, Vector3i point1, Vector3i point2, ClaimType type, UU
|
||||
this.type = type;
|
||||
this.id = UUID.randomUUID();
|
||||
this.context = new Context("gd_claim", this.id.toString());
|
||||
this.worldContext = new Context("world", world.getName().toLowerCase());
|
||||
this.overrideClaimContext = new Context("gd_claim_override", this.id.toString());
|
||||
this.cuboid = cuboid;
|
||||
this.parent = parent;
|
||||
@ -198,6 +200,7 @@ public GDClaim(World world, Vector3i lesserBoundaryCorner, Vector3i greaterBound
|
||||
this.type = type;
|
||||
this.cuboid = cuboid;
|
||||
this.context = new Context("gd_claim", this.id.toString());
|
||||
this.worldContext = new Context("world", world.getName().toLowerCase());
|
||||
this.hashCode = this.id.hashCode();
|
||||
this.worldClaimManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(this.world.getUID());
|
||||
if (this.type == ClaimTypes.WILDERNESS) {
|
||||
@ -3019,6 +3022,10 @@ public Context getOverrideClaimContext() {
|
||||
return this.overrideClaimContext;
|
||||
}
|
||||
|
||||
public Context getWorldContext() {
|
||||
return this.worldContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ClaimSchematic> getSchematics() {
|
||||
return this.schematics;
|
||||
|
@ -382,7 +382,9 @@ protected void showFlagPermissions(GDPermissionUser src, GDClaim claim, MenuType
|
||||
defaultContexts.add(ClaimContexts.WILDERNESS_DEFAULT_CONTEXT);
|
||||
overrideContexts.add(ClaimContexts.WILDERNESS_OVERRIDE_CONTEXT);
|
||||
}
|
||||
defaultContexts.add(claim.getWorldContext());
|
||||
defaultContexts.add(ClaimContexts.GLOBAL_DEFAULT_CONTEXT);
|
||||
overrideContexts.add(claim.getWorldContext());
|
||||
overrideContexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT);
|
||||
overrideContexts.add(claim.getOverrideClaimContext());
|
||||
|
||||
@ -622,6 +624,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
|
||||
filteredContexts.addAll(flagData.getContexts());
|
||||
Set<Context> newContexts = new HashSet<>(filteredContexts);
|
||||
newContexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT);
|
||||
newContexts.add(claim.getWorldContext());
|
||||
newContexts.add(claim.getOverrideTypeContext());
|
||||
newContexts.add(claim.getOverrideClaimContext());
|
||||
Tristate result = PermissionUtil.getInstance().getPermissionValueWithRequiredContexts(claim, GriefDefenderPlugin.DEFAULT_HOLDER, flagData.getFlag().getPermission(), newContexts, "gd_claim");
|
||||
@ -632,6 +635,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
|
||||
|
||||
// Check claim
|
||||
newContexts = new HashSet<>(filteredContexts);
|
||||
newContexts.add(claim.getWorldContext());
|
||||
newContexts.add(claim.getContext());
|
||||
result = PermissionUtil.getInstance().getPermissionValueWithRequiredContexts(claim, GriefDefenderPlugin.DEFAULT_HOLDER, flagData.getFlag().getPermission(), newContexts, "gd_claim");
|
||||
if (result != Tristate.UNDEFINED) {
|
||||
@ -641,6 +645,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
|
||||
|
||||
// Check default
|
||||
newContexts = new HashSet<>(filteredContexts);
|
||||
newContexts.add(claim.getWorldContext());
|
||||
newContexts.add(ClaimContexts.GLOBAL_DEFAULT_CONTEXT);
|
||||
newContexts.add(claim.getDefaultTypeContext());
|
||||
result = PermissionUtil.getInstance().getPermissionValueWithRequiredContexts(claim, GriefDefenderPlugin.DEFAULT_HOLDER, flagData.getFlag().getPermission(), newContexts, "gd_claim");
|
||||
|
@ -213,6 +213,7 @@ public Tristate getFinalPermission(Event event, Location location, Set<Context>
|
||||
}
|
||||
contexts.addAll(sourceContexts);
|
||||
contexts.addAll(targetContexts);
|
||||
contexts.add(((GDClaim) claim).getWorldContext());
|
||||
this.eventContexts = contexts;
|
||||
this.eventPlayerData = playerData;
|
||||
|
||||
@ -374,6 +375,7 @@ private Tristate getFlagOverride(Claim claim, GDPermissionHolder permissionHolde
|
||||
player = permissionHolder instanceof GDPermissionUser ? ((GDPermissionUser) permissionHolder).getOnlinePlayer() : null;
|
||||
}
|
||||
|
||||
contexts.add(((GDClaim) claim).getWorldContext());
|
||||
contexts.add(claim.getOverrideClaimContext());
|
||||
contexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT);
|
||||
contexts.addAll(this.eventContexts);
|
||||
|
@ -358,29 +358,24 @@ public Map<Set<Context>, Map<String, Boolean>> getPermanentPermissions(GDPermiss
|
||||
|
||||
final ImmutableCollection<Node> nodes = permissionHolder.getNodes().values();
|
||||
Map<Set<Context>, Map<String, Boolean>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, Boolean>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, Boolean> permissionEntry = permanentPermissionMap.get(contexts);
|
||||
if (permissionEntry == null) {
|
||||
permissionEntry = new HashMap<>();
|
||||
@ -402,29 +397,24 @@ public Map<Set<Context>, Map<String, Boolean>> getTransientPermissions(GDPermiss
|
||||
|
||||
final Set<? extends Node> nodes = permissionHolder.getTransientPermissions();
|
||||
Map<Set<Context>, Map<String, Boolean>> transientPermissionMap = new TreeMap<Set<Context>, Map<String, Boolean>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, Boolean> permissionEntry = transientPermissionMap.get(contexts);
|
||||
if (permissionEntry == null) {
|
||||
permissionEntry = new HashMap<>();
|
||||
@ -445,28 +435,23 @@ public Map<Set<Context>, Map<String, String>> getPermanentOptions(GDPermissionHo
|
||||
|
||||
final ImmutableCollection<Node> nodes = permissionHolder.getNodes().values();
|
||||
Map<Set<Context>, Map<String, String>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, String>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (!node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, String> metaEntry = permanentPermissionMap.get(contexts);
|
||||
if (metaEntry == null) {
|
||||
metaEntry = new HashMap<>();
|
||||
@ -487,28 +472,23 @@ public Map<Set<Context>, Map<String, String>> getTransientOptions(GDPermissionHo
|
||||
|
||||
final Set<? extends Node> nodes = permissionHolder.getTransientPermissions();
|
||||
Map<Set<Context>, Map<String, String>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, String>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (!node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, String> metaEntry = permanentPermissionMap.get(contexts);
|
||||
if (metaEntry == null) {
|
||||
metaEntry = new HashMap<>();
|
||||
|
@ -133,6 +133,7 @@ public class GDClaim implements Claim {
|
||||
// Permission Context
|
||||
private final Context context;
|
||||
private final Context overrideClaimContext;
|
||||
private final Context worldContext;
|
||||
private final org.spongepowered.api.service.context.Context spongeContext;
|
||||
private final org.spongepowered.api.service.context.Context spongeOverrideClaimContext;
|
||||
|
||||
@ -176,6 +177,7 @@ public GDClaim(World world, Vector3i point1, Vector3i point2, ClaimType type, UU
|
||||
this.type = type;
|
||||
this.id = UUID.randomUUID();
|
||||
this.context = new Context("gd_claim", this.id.toString());
|
||||
this.worldContext = new Context(world.getContext().getKey(), world.getContext().getValue().toLowerCase());
|
||||
this.overrideClaimContext = new Context("gd_claim_override", this.id.toString());
|
||||
this.spongeContext = SpongeUtil.getSpongeContext(this.context);
|
||||
this.spongeOverrideClaimContext = SpongeUtil.getSpongeContext(this.overrideClaimContext);
|
||||
@ -209,6 +211,7 @@ public GDClaim(World world, Vector3i lesserBoundaryCorner, Vector3i greaterBound
|
||||
this.type = type;
|
||||
this.cuboid = cuboid;
|
||||
this.context = new Context("gd_claim", this.id.toString());
|
||||
this.worldContext = new Context(world.getContext().getKey(), world.getContext().getValue().toLowerCase());
|
||||
this.spongeContext = SpongeUtil.getSpongeContext(this.context);
|
||||
this.spongeOverrideClaimContext = SpongeUtil.getSpongeContext(this.overrideClaimContext);
|
||||
this.hashCode = this.id.hashCode();
|
||||
@ -3069,6 +3072,10 @@ public Context getOverrideClaimContext() {
|
||||
return this.overrideClaimContext;
|
||||
}
|
||||
|
||||
public Context getWorldContext() {
|
||||
return this.worldContext;
|
||||
}
|
||||
|
||||
public org.spongepowered.api.service.context.Context getSpongeOverrideTypeContext() {
|
||||
if (this.isAdminClaim()) {
|
||||
return SpongeContexts.ADMIN_OVERRIDE_CONTEXT;
|
||||
|
@ -382,7 +382,9 @@ protected void showFlagPermissions(GDPermissionUser src, GDClaim claim, MenuType
|
||||
defaultContexts.add(ClaimContexts.WILDERNESS_DEFAULT_CONTEXT);
|
||||
overrideContexts.add(ClaimContexts.WILDERNESS_OVERRIDE_CONTEXT);
|
||||
}
|
||||
defaultContexts.add(claim.getWorldContext());
|
||||
defaultContexts.add(ClaimContexts.GLOBAL_DEFAULT_CONTEXT);
|
||||
overrideContexts.add(claim.getWorldContext());
|
||||
overrideContexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT);
|
||||
overrideContexts.add(claim.getOverrideClaimContext());
|
||||
|
||||
@ -622,6 +624,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
|
||||
filteredContexts.addAll(flagData.getContexts());
|
||||
Set<Context> newContexts = new HashSet<>(filteredContexts);
|
||||
newContexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT);
|
||||
newContexts.add(claim.getWorldContext());
|
||||
newContexts.add(claim.getOverrideTypeContext());
|
||||
newContexts.add(claim.getOverrideClaimContext());
|
||||
Tristate result = PermissionUtil.getInstance().getPermissionValueWithRequiredContexts(claim, GriefDefenderPlugin.DEFAULT_HOLDER, flagData.getFlag().getPermission(), newContexts, "gd_claim");
|
||||
@ -632,6 +635,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
|
||||
|
||||
// Check claim
|
||||
newContexts = new HashSet<>(filteredContexts);
|
||||
newContexts.add(claim.getWorldContext());
|
||||
newContexts.add(claim.getContext());
|
||||
result = PermissionUtil.getInstance().getPermissionValueWithRequiredContexts(claim, GriefDefenderPlugin.DEFAULT_HOLDER, flagData.getFlag().getPermission(), newContexts, "gd_claim");
|
||||
if (result != Tristate.UNDEFINED) {
|
||||
@ -641,6 +645,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
|
||||
|
||||
// Check default
|
||||
newContexts = new HashSet<>(filteredContexts);
|
||||
newContexts.add(claim.getWorldContext());
|
||||
newContexts.add(ClaimContexts.GLOBAL_DEFAULT_CONTEXT);
|
||||
newContexts.add(claim.getDefaultTypeContext());
|
||||
result = PermissionUtil.getInstance().getPermissionValueWithRequiredContexts(claim, GriefDefenderPlugin.DEFAULT_HOLDER, flagData.getFlag().getPermission(), newContexts, "gd_claim");
|
||||
|
@ -350,6 +350,10 @@ public boolean test(Entity entity) {
|
||||
if (GriefDefenderPlugin.isTargetIdBlacklisted(Flags.ENTITY_CHUNK_SPAWN.getName(), entity, world.getProperties())) {
|
||||
return true;
|
||||
}
|
||||
// Always allow item frames in chunks to spawn
|
||||
if (entity instanceof ItemFrame) {
|
||||
return true;
|
||||
}
|
||||
permission = GDPermissions.ENTITY_CHUNK_SPAWN;
|
||||
}
|
||||
|
||||
|
@ -272,6 +272,7 @@ public Tristate getFinalPermission(Event event, Location<World> location, Set<Co
|
||||
}
|
||||
contexts.addAll(sourceContexts);
|
||||
contexts.addAll(targetContexts);
|
||||
contexts.add(((GDClaim) claim).getWorldContext());
|
||||
this.eventContexts = contexts;
|
||||
this.eventPlayerData = playerData;
|
||||
|
||||
@ -428,6 +429,7 @@ private Tristate getFlagOverride(Claim claim, GDPermissionHolder permissionHolde
|
||||
player = permissionHolder instanceof GDPermissionUser ? ((GDPermissionUser) permissionHolder).getOnlinePlayer() : null;
|
||||
}
|
||||
|
||||
contexts.add(((GDClaim) claim).getWorldContext());
|
||||
contexts.add(claim.getOverrideClaimContext());
|
||||
contexts.add(ClaimContexts.GLOBAL_OVERRIDE_CONTEXT);
|
||||
contexts.addAll(this.eventContexts);
|
||||
|
@ -353,29 +353,24 @@ public Map<Set<Context>, Map<String, Boolean>> getPermanentPermissions(GDPermiss
|
||||
|
||||
final ImmutableCollection<Node> nodes = permissionHolder.getNodes().values();
|
||||
Map<Set<Context>, Map<String, Boolean>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, Boolean>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, Boolean> permissionEntry = permanentPermissionMap.get(contexts);
|
||||
if (permissionEntry == null) {
|
||||
permissionEntry = new HashMap<>();
|
||||
@ -397,29 +392,24 @@ public Map<Set<Context>, Map<String, Boolean>> getTransientPermissions(GDPermiss
|
||||
|
||||
final Set<? extends Node> nodes = permissionHolder.getTransientPermissions();
|
||||
Map<Set<Context>, Map<String, Boolean>> transientPermissionMap = new TreeMap<Set<Context>, Map<String, Boolean>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, Boolean> permissionEntry = transientPermissionMap.get(contexts);
|
||||
if (permissionEntry == null) {
|
||||
permissionEntry = new HashMap<>();
|
||||
@ -440,28 +430,23 @@ public Map<Set<Context>, Map<String, String>> getPermanentOptions(GDPermissionHo
|
||||
|
||||
final ImmutableCollection<Node> nodes = permissionHolder.getNodes().values();
|
||||
Map<Set<Context>, Map<String, String>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, String>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (!node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, String> metaEntry = permanentPermissionMap.get(contexts);
|
||||
if (metaEntry == null) {
|
||||
metaEntry = new HashMap<>();
|
||||
@ -482,28 +467,23 @@ public Map<Set<Context>, Map<String, String>> getTransientOptions(GDPermissionHo
|
||||
|
||||
final Set<? extends Node> nodes = permissionHolder.getTransientPermissions();
|
||||
Map<Set<Context>, Map<String, String>> permanentPermissionMap = new TreeMap<Set<Context>, Map<String, String>>(CONTEXT_COMPARATOR);
|
||||
Map<ContextSet, Set<Context>> contextMap = new HashMap<>();
|
||||
for (Node node : nodes) {
|
||||
if (!node.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
String serverName = node.getServer().orElse(null);
|
||||
final String worldName = node.getWorld().orElse(null);
|
||||
if (serverName != null && serverName.equalsIgnoreCase("global")) {
|
||||
serverName = null;
|
||||
}
|
||||
Set<Context> contexts = null;
|
||||
if (contextMap.get(node.getContexts()) == null) {
|
||||
contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
contextMap.put(node.getContexts(), contexts);
|
||||
} else {
|
||||
contexts = contextMap.get(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
Set<Context> contexts = getGPContexts(node.getContexts());
|
||||
if (serverName != null && !serverName.equalsIgnoreCase("undefined")) {
|
||||
contexts.add(new Context("server", serverName));
|
||||
}
|
||||
if (worldName != null) {
|
||||
contexts.add(new Context("world", worldName.toLowerCase()));
|
||||
}
|
||||
|
||||
Map<String, String> metaEntry = permanentPermissionMap.get(contexts);
|
||||
if (metaEntry == null) {
|
||||
metaEntry = new HashMap<>();
|
||||
|
Loading…
Reference in New Issue
Block a user