Class HasSpentMoneyCondition

java.lang.Object
games.stendhal.server.entity.npc.condition.AbstractChatCondition
games.stendhal.server.entity.npc.condition.HasSpentMoneyCondition
All Implemented Interfaces:
ChatCondition, PreTransitionCondition

public class HasSpentMoneyCondition extends AbstractChatCondition
Condition to check if a player has spent an amount of money by buying from NPCs.
  • Constructor Details

    • HasSpentMoneyCondition

      public HasSpentMoneyCondition(int amount)
      Creates a condition that checks if player has spent an amount of money with any NPC.
      Parameters:
      amount - The minimum amount required.
    • HasSpentMoneyCondition

      public HasSpentMoneyCondition(int amount, String... npcs)
      Creates a condition that checks if player has spent an amount of money with each NPC.
      Parameters:
      amount - The minimum amount required.
      npcs - NPC seller names.
    • HasSpentMoneyCondition

      public HasSpentMoneyCondition(int amount, List<String> npcs)
      Creates a condition that checks if player has spent an amount of money with each NPC.
      Parameters:
      amount - The minimum amount required.
      npcs - NPC seller names.
    • HasSpentMoneyCondition

      public HasSpentMoneyCondition(Map<String,Integer> amounts)
      Creates a condition that checks if player has spent an amount of money with each NPC.
      Parameters:
      amounts - NPC seller names & amount required for each.
  • Method Details

    • fire

      public boolean fire(Player player, Sentence sentence, Entity entity)
      Description copied from interface: PreTransitionCondition
      can the transition be done?
      Parameters:
      player - player who caused the transition
      sentence - text he/she said
      entity - the NPC doing the transition
      Returns:
      true, if the transition is possible, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object