Record Class PermissionDynamicContextKey<T>
java.lang.Object
java.lang.Record
net.minecraftforge.server.permission.nodes.PermissionDynamicContextKey<T>
public record PermissionDynamicContextKey<T>(Class<T> typeToken, String name, Function<T,String> serializer)
extends Record
Represents a key that can be used to build a
PermissionDynamicContext.
Keys, along with their associated values, can be used to provide additional context for a permission handler in determining whether to grant permission for an actor and a specific node.
As an example usage, a dimension context key could be used inside a building permission check to ensure that the actor can build given those constraints.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateContext(T value) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.Returns the value of theserializerrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetypeTokenrecord component.
-
Field Details
-
typeToken
The field for thetypeTokenrecord component. -
name
The field for thenamerecord component. -
serializer
The field for theserializerrecord component.
-
-
Constructor Details
-
PermissionDynamicContextKey
Creates an instance of aPermissionDynamicContextKeyrecord class.- Parameters:
typeToken- the value for thetypeTokenrecord componentname- the value for thenamerecord componentserializer- the value for theserializerrecord component
-
-
Method Details
-
createContext
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
typeToken
Returns the value of thetypeTokenrecord component.- Returns:
- the value of the
typeTokenrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
serializer
Returns the value of theserializerrecord component.- Returns:
- the value of the
serializerrecord component
-