Class GlobalPlaceholderEngine

java.lang.Object
ml.karmaconfigs.api.common.utils.placeholder.util.PlaceholderEngine
ml.karmaconfigs.api.common.utils.placeholder.GlobalPlaceholderEngine

public final class GlobalPlaceholderEngine extends PlaceholderEngine
Global KarmaAPI placeholder engine
  • Constructor Details

    • GlobalPlaceholderEngine

      public GlobalPlaceholderEngine(KarmaSource owner)
      Initialize the global placeholder engine
      Parameters:
      owner - the placeholder owner
  • Method Details

    • setOpenIdentifier

      public void setOpenIdentifier(char identifier)
      Set the placeholder open identifier
      Specified by:
      setOpenIdentifier in class PlaceholderEngine
      Parameters:
      identifier - the placeholder identifier character
    • setCloseIdentifier

      public void setCloseIdentifier(char identifier)
      Set the placeholder close identifier
      Specified by:
      setCloseIdentifier in class PlaceholderEngine
      Parameters:
      identifier - the placeholder identifier character
    • protect

      public void protect()
      Protect the placeholder engine against already added placeholder modifications
      Specified by:
      protect in class PlaceholderEngine
    • register

      @SafeVarargs public final <T> void register(Placeholder<T>... placeholders)
      Register more placeholders
      Specified by:
      register in class PlaceholderEngine
      Type Parameters:
      T - the placeholder type
      Parameters:
      placeholders - the placeholders to register
    • registerUnsafe

      @Unstable(reason="The normal register method should be used instead as this method may register non desired placeholders") public void registerUnsafe(Placeholder<?>... placeholders)
      Register placeholders indiscriminately
      Specified by:
      registerUnsafe in class PlaceholderEngine
      Parameters:
      placeholders - the placeholders to register
    • forceRegister

      @SafeVarargs @Unstable(reason="Using this method may register null placeholders which can cause more issues in the future") public final <T> void forceRegister(Placeholder<T>... placeholders)
      Force placeholder registrations
      Specified by:
      forceRegister in class PlaceholderEngine
      Type Parameters:
      T - the placeholder type
      Parameters:
      placeholders - the placeholders to register
    • unregister

      public void unregister(String... placeholders)
      Unregister placeholders
      Specified by:
      unregister in class PlaceholderEngine
      Parameters:
      placeholders - the placeholders to unregister
    • unregister

      @SafeVarargs public final <T> void unregister(Placeholder<T>... placeholders)
      Unregister placeholders
      Specified by:
      unregister in class PlaceholderEngine
      Type Parameters:
      T - the placeholder type
      Parameters:
      placeholders - the placeholders to unregister
    • getPlaceholder

      @Unstable(reason="Return method may differ from stored method") @Nullable public <T> @Nullable Placeholder<T> getPlaceholder(String key)
      Get a placeholder
      Specified by:
      getPlaceholder in class PlaceholderEngine
      Type Parameters:
      T - the placeholder type
      Parameters:
      key - the placeholder identifier
      Returns:
      the placeholder
    • parse

      public String parse(String message, Object... containers)
      Parse a message
      Specified by:
      parse in class PlaceholderEngine
      Parameters:
      message - the message
      containers - the placeholder containers
      Returns:
      the parsed message
    • parse

      public List<String> parse(List<String> message, Object... containers)
      Parse a message
      Specified by:
      parse in class PlaceholderEngine
      Parameters:
      message - the message
      containers - the placeholder containers
      Returns:
      the parsed message
    • parse

      public String[] parse(String[] message, Object... containers)
      Parse a message
      Specified by:
      parse in class PlaceholderEngine
      Parameters:
      message - the message
      containers - the placeholder containers
      Returns:
      the parsed message
    • getKeys

      public Set<Placeholder<?>> getKeys()
      Get all the placeholders registered to this engine
      Specified by:
      getKeys in class PlaceholderEngine
      Returns:
      the placeholder keys