mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-15 21:01:34 +01:00
Fix NPE from permission holder initialisation order (#3263)
This commit is contained in:
parent
a53c9fad00
commit
f61d9ff9f0
@ -37,8 +37,8 @@ public class InheritanceOrigin implements InheritanceOriginMetadata {
|
||||
private final DataType dataType;
|
||||
|
||||
public InheritanceOrigin(PermissionHolderIdentifier origin, DataType dataType) {
|
||||
this.origin = origin;
|
||||
this.dataType = dataType;
|
||||
this.origin = Objects.requireNonNull(origin, "origin");
|
||||
this.dataType = Objects.requireNonNull(dataType, "dataType");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -110,7 +110,7 @@ public abstract class PermissionHolder {
|
||||
*
|
||||
* @see #normalData()
|
||||
*/
|
||||
private final RecordedNodeMap normalNodes = new RecordedNodeMap(new NodeMapMutable(this, DataType.NORMAL));
|
||||
private final RecordedNodeMap normalNodes;
|
||||
|
||||
/**
|
||||
* The holders transient nodes.
|
||||
@ -122,12 +122,12 @@ public abstract class PermissionHolder {
|
||||
*
|
||||
* @see #transientData()
|
||||
*/
|
||||
private final NodeMap transientNodes = new NodeMapMutable(this, DataType.TRANSIENT);
|
||||
private final NodeMap transientNodes;
|
||||
|
||||
/**
|
||||
* Comparator used to ordering groups when calculating inheritance
|
||||
*/
|
||||
private final Comparator<? super PermissionHolder> inheritanceComparator = InheritanceComparator.getFor(this);
|
||||
private final Comparator<? super PermissionHolder> inheritanceComparator;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
@ -137,6 +137,9 @@ public abstract class PermissionHolder {
|
||||
protected PermissionHolder(LuckPermsPlugin plugin, String objectName) {
|
||||
this.plugin = plugin;
|
||||
this.identifier = new PermissionHolderIdentifier(getType(), objectName);
|
||||
this.normalNodes = new RecordedNodeMap(new NodeMapMutable(this, DataType.NORMAL));
|
||||
this.transientNodes = new NodeMapMutable(this, DataType.TRANSIENT);
|
||||
this.inheritanceComparator = InheritanceComparator.getFor(this);
|
||||
}
|
||||
|
||||
// getters
|
||||
|
@ -36,15 +36,15 @@ public final class PermissionHolderIdentifier implements Identifier {
|
||||
private final String name;
|
||||
|
||||
public PermissionHolderIdentifier(HolderType type, String name) {
|
||||
this.type = type == HolderType.USER
|
||||
this.type = Objects.requireNonNull(type, "type") == HolderType.USER
|
||||
? Identifier.USER_TYPE
|
||||
: Identifier.GROUP_TYPE;
|
||||
this.name = name;
|
||||
this.name = Objects.requireNonNull(name, "name");
|
||||
}
|
||||
|
||||
public PermissionHolderIdentifier(String type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.type = Objects.requireNonNull(type, "type");
|
||||
this.name = Objects.requireNonNull(name, "name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user