Record Class AudiencePlaceholder<A extends Audience>

java.lang.Object
java.lang.Record
io.github.miniplaceholders.api.placeholder.AudiencePlaceholder<A>
Type Parameters:
A - the parametrized type
Record Components:
targetClass - the type of audience from which this placeholder can obtain information
key - the full placeholder key
name - the name of this placeholder
resolver - the object responsible for obtaining audience information
All Implemented Interfaces:
Placeholder, TagResolver

@NullMarked public record AudiencePlaceholder<A extends Audience>(@Nullable Class<A extends Audience> targetClass, String key, String name, AudienceTagResolver<A extends Audience> resolver) extends Record implements Placeholder
A placeholder that can be applied based on an audience of the specified type.
  • Constructor Details

    • AudiencePlaceholder

      public AudiencePlaceholder(@Nullable @Nullable Class<A> targetClass, @TagPattern String key, String name, AudienceTagResolver<A> resolver)
      Creates an instance of a AudiencePlaceholder record class.
      Parameters:
      targetClass - the value for the targetClass record component
      key - the value for the key record component
      name - the value for the name record component
      resolver - the value for the resolver record component
  • Method Details

    • single

      public static <A extends Audience> AudiencePlaceholder<A> single(@Nullable @Nullable Class<A> targetClass, @TagPattern String key, String name, AudienceTagResolver<A> resolver)
      Creates a new AudiencePlaceholder.
      Type Parameters:
      A - the parametrized type
      Parameters:
      targetClass - the type of audience from which this placeholder can obtain information
      key - the placeholder key
      name - the name of this placeholder
      resolver - the object responsible for obtaining audience information
      Returns:
      a new AudiencePlaceholder
    • resolve

      @Nullable public @Nullable Tag resolve(String name, ArgumentQueue arguments, Context ctx)
      Specified by:
      resolve in interface TagResolver
    • has

      public boolean has(String name)
      Specified by:
      has in interface TagResolver
    • equals

      public boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • targetClass

      @Nullable public @Nullable Class<A> targetClass()
      Returns the value of the targetClass record component.
      Returns:
      the value of the targetClass record component
    • key

      @TagPattern public String key()
      Returns the value of the key record component.
      Specified by:
      key in interface Placeholder
      Returns:
      the value of the key record component
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface Placeholder
      Returns:
      the value of the name record component
    • resolver

      public AudienceTagResolver<A> resolver()
      Returns the value of the resolver record component.
      Returns:
      the value of the resolver record component