Class PlayerVsPlayerChallengeManager
java.lang.Object
games.stendhal.server.core.rp.pvp.PlayerVsPlayerChallengeManager
- All Implemented Interfaces:
LogoutListener
,TurnListener
The PlayerVsPlayerChallengeManager stores, expires and creates PvP duels to allow
two players to fight with each other
- Author:
- markus
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accpetChallenge(Player challenger, Player challenged, int currentTurn)
Mark the challenge between challenger and challenged as acceptedcreate()
void
createChallenge(Player challenger, Player challenged, int currentTurn)
Create a new challenge between two players if not yet existing.protected PlayerVsPlayerChallenge
getOpenChallengeForPlayers(Player challenger, Player challenged)
Finds an open challenge for the given pair of players if existingvoid
onLoggedOut(Player player)
Remove player's current challenges on log outvoid
onTurnReached(int currentTurn)
This method is called when the turn number is reached.boolean
playersHaveActiveChallenge(Player attacker, Player victim)
void
timeOutCurrentChallenges(int currentTurn)
Filters out challenges that have to time out at the given turn
-
Field Details
-
TIMEOUT_FOR_ACCEPTANCE
protected static final int TIMEOUT_FOR_ACCEPTANCE- See Also:
- Constant Field Values
-
-
Method Details
-
create
-
createChallenge
Create a new challenge between two players if not yet existing.- Parameters:
challenger
-challenged
-currentTurn
-
-
accpetChallenge
Mark the challenge between challenger and challenged as accepted- Parameters:
challenger
-challenged
-currentTurn
-
-
getOpenChallengeForPlayers
Finds an open challenge for the given pair of players if existing- Parameters:
challenger
-challenged
-- Returns:
- a currently open challenge object or null
-
onTurnReached
public void onTurnReached(int currentTurn)Description copied from interface:TurnListener
This method is called when the turn number is reached.- Specified by:
onTurnReached
in interfaceTurnListener
- Parameters:
currentTurn
- current turn number
-
timeOutCurrentChallenges
public void timeOutCurrentChallenges(int currentTurn)Filters out challenges that have to time out at the given turn- Parameters:
currentTurn
-
-
onLoggedOut
Remove player's current challenges on log out- Specified by:
onLoggedOut
in interfaceLogoutListener
- Parameters:
player
- The player having logged out.
-
playersHaveActiveChallenge
-