Class ConditionBuilder

java.lang.Object
games.stendhal.server.entity.npc.ConditionBuilder

public class ConditionBuilder extends Object
A builder for combining ChatConditions. An example combined condition generated with the static factory methods in ChatConditions.
 
     greetingMatchesName(npc.getName())
         .and(questInState(QUEST_SLOT, "start"))
         .unless(playerCarriesItem("empty goblet")
             .or(playerCarriesItem("goblet")))
         .build();
 
 
  • Constructor Details

    • ConditionBuilder

      public ConditionBuilder(ChatCondition condition)
      Create a new ConditionBuilder. This is meant primarily for the use of the static factory methods in ChatConditions.
      Parameters:
      condition -
  • Method Details

    • and

      public ConditionBuilder and(ConditionBuilder child)
      Combine the condition represented by this builder with the child using logical AND.
      Parameters:
      child -
      Returns:
      the builder itself
      See Also:
    • or

      Combine the condition represented by this builder with the child using logical OR.
      Parameters:
      child -
      Returns:
      the builder itself
      See Also:
    • unless

      public ConditionBuilder unless(ConditionBuilder child)
      A convenience method for combining the condition represented by this builder with the child using logical AND NOT. This is equivalent to builder.and(not(child)) which may be more appropriate in some cases.
      Parameters:
      child -
      Returns:
      the builder itself
      See Also:
    • build

      public ChatCondition build()
      Build the ChatCondition represented by this builder.
      Returns:
      a ChatCondition