Class AllotmentUtilities

java.lang.Object
games.stendhal.server.maps.quests.allotment.AllotmentUtilities
All Implemented Interfaces:
TurnListener

public class AllotmentUtilities extends Object implements TurnListener
  • Field Details

    • QUEST_SLOT

      public static String QUEST_SLOT
      Name of the quest used for quest slot
    • RENTAL_TIME

      public static long RENTAL_TIME
      Amount of time which an allotment can be rented out
  • Method Details

    • get

      public static AllotmentUtilities get()
      Singleton getter
      Returns:
      the instance of this singleton
    • setExpirationTime

      public boolean setExpirationTime(String zoneName, String allotment, String player)
      Sets the new expiration time for an allotment
      Parameters:
      zoneName - the zone where the allotment is
      allotment - the name of the allotment (found in the zone's xml file)
      player - name of the renting player
      Returns:
      true if successful, false otherwise
    • getKey

      public GateKey getKey(String zoneName, String player)
      Gets a key to an allotment that has been rented out
      Parameters:
      zoneName - the zone the allotment is in
      player -
      Returns:
      a key to the allotment
    • getTimeLeftPlayer

      public long getTimeLeftPlayer(String zoneName, String player)
      Gets the rental time left given a player
      Parameters:
      zoneName - zone where the allotment is
      player - the player who is enquiring about the time left
      Returns:
      the time remaining till the allotment expires
    • getNextExpiryTime

      public long getNextExpiryTime(String zoneName)
      Gets the time that the next allotment expires
      Parameters:
      zoneName - allotment zone
      Returns:
      the expiry time for the next allotment that expires
    • getTimeLeftAllotment

      public long getTimeLeftAllotment(String zoneName, String allotment)
      Gets the rental time left given an allotment
      Parameters:
      zoneName - allotment zone
      allotment - the allotment to check
      Returns:
      the time remaining till the allotment expires
    • isValidAllotment

      public boolean isValidAllotment(String zoneName, String allotment)
      Checks if an allotment exists
      Parameters:
      zoneName - the zone where the allotment is in
      allotment -
      Returns:
      boolean
    • isAvailableAllotment

      public boolean isAvailableAllotment(String zoneName, String allotment)
      Checks if an allotment is available
      Parameters:
      zoneName - the zone where the allotment is in
      allotment -
      Returns:
      boolean
    • getAvailableAllotments

      public List<String> getAvailableAllotments(String zoneName)
      Get all available allotments in a zone
      Parameters:
      zoneName - the zone to get allotments for
      Returns:
      a list of available allotment numbers
    • onTurnReached

      public void onTurnReached(int currentTurn)
      Callback for TurnNotifier - periodically checks if any allotment has expired and kicks players if it has
      Specified by:
      onTurnReached in interface TurnListener
      Parameters:
      currentTurn - current turn number