Class PlaceholderEngine

java.lang.Object
ml.karmaconfigs.api.common.utils.placeholder.util.PlaceholderEngine
Direct Known Subclasses:
GlobalPlaceholderEngine

public abstract class PlaceholderEngine extends Object
Karma placeholder engine
  • Constructor Details

    • PlaceholderEngine

      public PlaceholderEngine()
  • Method Details

    • setOpenIdentifier

      public abstract void setOpenIdentifier(char identifier)
      Set the placeholder open identifier
      Parameters:
      identifier - the placeholder identifier character
    • setCloseIdentifier

      public abstract void setCloseIdentifier(char identifier)
      Set the placeholder close identifier
      Parameters:
      identifier - the placeholder identifier character
    • protect

      public abstract void protect()
      Protect the placeholder engine against already added placeholder modifications
    • register

      public abstract <T> void register(Placeholder<T>... placeholders)
      Register more placeholders
      Type Parameters:
      T - the placeholder type
      Parameters:
      placeholders - the placeholders to register
    • registerUnsafe

      public abstract void registerUnsafe(Placeholder<?>... placeholders)
      Register placeholders indiscriminately
      Parameters:
      placeholders - the placeholders to register
    • forceRegister

      public abstract <T> void forceRegister(Placeholder<T>... placeholders)
      Force placeholder registrations
      Type Parameters:
      T - the placeholder type
      Parameters:
      placeholders - the placeholders to register
    • unregister

      public abstract void unregister(String... placeholders)
      Unregister placeholders
      Parameters:
      placeholders - the placeholders to unregister
    • unregister

      public abstract <T> void unregister(Placeholder<T>... placeholders)
      Unregister placeholders
      Type Parameters:
      T - the placeholder type
      Parameters:
      placeholders - the placeholders to unregister
    • getPlaceholder

      @Nullable public abstract <T> @Nullable Placeholder<T> getPlaceholder(String key)
      Get a placeholder
      Type Parameters:
      T - the placeholder type
      Parameters:
      key - the placeholder identifier
      Returns:
      the placeholder
    • parse

      public abstract String parse(String message, Object... containers)
      Parse a message
      Parameters:
      message - the message
      containers - the placeholder containers
      Returns:
      the parsed message
    • parse

      public abstract List<String> parse(List<String> message, Object... containers)
      Parse a message
      Parameters:
      message - the message
      containers - the placeholder containers
      Returns:
      the parsed message
    • parse

      public abstract String[] parse(String[] message, Object... containers)
      Parse a message
      Parameters:
      message - the message
      containers - the placeholder containers
      Returns:
      the parsed message
    • getKeys

      public abstract Set<Placeholder<?>> getKeys()
      Get all the placeholders registered to this engine
      Returns:
      the placeholder keys
    • toString

      public final String toString()
      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

      The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

       getClass().getName() + '@' + Integer.toHexString(hashCode())
       
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.