Class AllotmentUtilities
java.lang.Object
games.stendhal.server.maps.quests.allotment.AllotmentUtilities
- All Implemented Interfaces:
TurnListener
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
Name of the quest used for quest slotstatic long
Amount of time which an allotment can be rented out -
Method Summary
Modifier and TypeMethodDescriptionstatic AllotmentUtilities
get()
Singleton gettergetAvailableAllotments(String zoneName)
Get all available allotments in a zoneGets a key to an allotment that has been rented outlong
getNextExpiryTime(String zoneName)
Gets the time that the next allotment expireslong
getTimeLeftAllotment(String zoneName, String allotment)
Gets the rental time left given an allotmentlong
getTimeLeftPlayer(String zoneName, String player)
Gets the rental time left given a playerboolean
isAvailableAllotment(String zoneName, String allotment)
Checks if an allotment is availableboolean
isValidAllotment(String zoneName, String allotment)
Checks if an allotment existsvoid
onTurnReached(int currentTurn)
Callback for TurnNotifier - periodically checks if any allotment has expired and kicks players if it hasboolean
setExpirationTime(String zoneName, String allotment, String player)
Sets the new expiration time for an allotment
-
Field Details
-
QUEST_SLOT
Name of the quest used for quest slot -
RENTAL_TIME
public static long RENTAL_TIMEAmount of time which an allotment can be rented out
-
-
Method Details
-
get
Singleton getter- Returns:
- the instance of this singleton
-
setExpirationTime
Sets the new expiration time for an allotment- Parameters:
zoneName
- the zone where the allotment isallotment
- 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
Gets a key to an allotment that has been rented out- Parameters:
zoneName
- the zone the allotment is inplayer
-- Returns:
- a key to the allotment
-
getTimeLeftPlayer
Gets the rental time left given a player- Parameters:
zoneName
- zone where the allotment isplayer
- the player who is enquiring about the time left- Returns:
- the time remaining till the allotment expires
-
getNextExpiryTime
Gets the time that the next allotment expires- Parameters:
zoneName
- allotment zone- Returns:
- the expiry time for the next allotment that expires
-
getTimeLeftAllotment
Gets the rental time left given an allotment- Parameters:
zoneName
- allotment zoneallotment
- the allotment to check- Returns:
- the time remaining till the allotment expires
-
isValidAllotment
Checks if an allotment exists- Parameters:
zoneName
- the zone where the allotment is inallotment
-- Returns:
- boolean
-
isAvailableAllotment
Checks if an allotment is available- Parameters:
zoneName
- the zone where the allotment is inallotment
-- Returns:
- boolean
-
getAvailableAllotments
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 interfaceTurnListener
- Parameters:
currentTurn
- current turn number
-