Class ConditionProcessor

java.lang.Object
org.kingdoms.utils.conditions.ConditionProcessor
All Implemented Interfaces:
Function<String,Object>, org.kingdoms.utils.compilers.translators.ConditionalVariableTranslator, org.kingdoms.utils.compilers.translators.VariableTranslator<Object>

public final class ConditionProcessor extends Object implements org.kingdoms.utils.compilers.translators.ConditionalVariableTranslator
  • Constructor Details

    • ConditionProcessor

      public ConditionProcessor(PlaceholderProvider placeholderContextProvider)
  • Method Details

    • process

      public static boolean process(org.kingdoms.utils.compilers.expressions.ConditionalExpression condition, PlaceholderProvider placeholderContextProvider)
    • mapConditions

      public static org.kingdoms.utils.conditions.ConditionChain<Messenger> mapConditions(ConfigSection section)
    • mapConditions

      public static org.kingdoms.utils.conditions.ConditionChain<Messenger> mapConditions(ConfigSection section, boolean asPath)
      Processes a list of conditions in form of YAML configs with keys as the condition and values as the message being sent.

      E.g. conditions: 'money < 0': "You don't have enough money" 'other condition': "another message" ...

      Parameters:
      asPath - whether to parse the messages as absolute language paths or compile it as a message. This option is pretty much should never be true because newer versions support special language path variables.
    • apply

      public Object apply(String x)
      Specified by:
      apply in interface Function<String,Object>