mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
More workarounds to support MassiveCore's modification of attachment permissions via reflection
This commit is contained in:
parent
644c53a074
commit
f4e4f727dd
@ -53,12 +53,12 @@ public class DummyPermissibleBase extends PermissibleBase {
|
||||
|
||||
public static void nullFields(PermissibleBase permissibleBase) {
|
||||
try {
|
||||
ATTACHMENTS_FIELD.set(permissibleBase, null);
|
||||
ATTACHMENTS_FIELD.set(permissibleBase, Collections.emptyList());
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
PERMISSIONS_FIELD.set(permissibleBase, null);
|
||||
PERMISSIONS_FIELD.set(permissibleBase, Collections.emptyMap());
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class LPPermissionAttachment extends PermissionAttachment {
|
||||
public LPPermissionAttachment(LPPermissible permissible, PermissionAttachment source) {
|
||||
super(DummyPlugin.INSTANCE, null);
|
||||
this.permissible = permissible;
|
||||
this.owner = null;
|
||||
this.owner = source.getPlugin();
|
||||
|
||||
// copy
|
||||
this.perms.putAll(source.getPermissions());
|
||||
@ -389,19 +389,29 @@ public class LPPermissionAttachment extends PermissionAttachment {
|
||||
@Override
|
||||
public Set<String> keySet() {
|
||||
// just proxy
|
||||
return LPPermissionAttachment.this.perms.keySet();
|
||||
return Collections.unmodifiableSet(LPPermissionAttachment.this.perms.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Boolean> values() {
|
||||
// just proxy
|
||||
return LPPermissionAttachment.this.perms.values();
|
||||
return Collections.unmodifiableCollection(LPPermissionAttachment.this.perms.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<String, Boolean>> entrySet() {
|
||||
// just proxy
|
||||
return LPPermissionAttachment.this.perms.entrySet();
|
||||
return Collections.unmodifiableSet(LPPermissionAttachment.this.perms.entrySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Map<?, ?> && LPPermissionAttachment.this.perms.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return LPPermissionAttachment.this.perms.hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ public class DummyPermissibleBase extends PermissibleBase {
|
||||
|
||||
public static void nullFields(PermissibleBase permissibleBase) {
|
||||
try {
|
||||
ATTACHMENTS_FIELD.set(permissibleBase, null);
|
||||
ATTACHMENTS_FIELD.set(permissibleBase, Collections.emptyList());
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
PERMISSIONS_FIELD.set(permissibleBase, null);
|
||||
PERMISSIONS_FIELD.set(permissibleBase, Collections.emptyMap());
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
@ -109,13 +109,13 @@ public class LPPermissionAttachment extends PermissionAttachment {
|
||||
injectFakeMap();
|
||||
}
|
||||
|
||||
public LPPermissionAttachment(LPPermissible permissible, PermissionAttachment nukkit) {
|
||||
public LPPermissionAttachment(LPPermissible permissible, PermissionAttachment source) {
|
||||
super(DummyPlugin.INSTANCE, null);
|
||||
this.permissible = permissible;
|
||||
this.owner = null;
|
||||
this.owner = source.getPlugin();
|
||||
|
||||
// copy
|
||||
this.perms.putAll(nukkit.getPermissions());
|
||||
this.perms.putAll(source.getPermissions());
|
||||
this.source = source;
|
||||
|
||||
injectFakeMap();
|
||||
@ -419,19 +419,29 @@ public class LPPermissionAttachment extends PermissionAttachment {
|
||||
@Override
|
||||
public Set<String> keySet() {
|
||||
// just proxy
|
||||
return LPPermissionAttachment.this.perms.keySet();
|
||||
return Collections.unmodifiableSet(LPPermissionAttachment.this.perms.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Boolean> values() {
|
||||
// just proxy
|
||||
return LPPermissionAttachment.this.perms.values();
|
||||
return Collections.unmodifiableCollection(LPPermissionAttachment.this.perms.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<String, Boolean>> entrySet() {
|
||||
// just proxy
|
||||
return LPPermissionAttachment.this.perms.entrySet();
|
||||
return Collections.unmodifiableSet(LPPermissionAttachment.this.perms.entrySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Map<?, ?> && LPPermissionAttachment.this.perms.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return LPPermissionAttachment.this.perms.hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user