edu.lmu.lmusleuth.server
Class ClientConnection

java.lang.Object
  |
  +--edu.lmu.lmusleuth.server.ClientConnection
All Implemented Interfaces:
GameChangeListener

public class ClientConnection
extends java.lang.Object
implements GameChangeListener


Constructor Summary
ClientConnection()
           
 
Method Summary
 void askRefute(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player is being asked if they can refute the evidence.
 void assertion(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player is attempting to win the game.
 void beginTurn(Game g, Player p)
          A player's turn has begun.
 void chat(Game g, Player p, java.lang.String message)
          The player has sent a public chat message.
 void clearStartVotes(Game g)
          All start votes have been set back to 'false'.
 void endTurn(Game g, Player p)
          A player's turn has ended.
 void hypothesis(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player has posed the given hypothesis.
 void lose(Game g, Player p)
          A player has lost the game.
 void move(Game g, Evidence.Suspect p, Location l)
          A suspect has moved to a new location in the game.
 void newPlayer(Game g, Player p)
          A player has joined the game.
 void newPlayerSuspect(Game g, Player p, Evidence.Suspect s)
          A player has selected a new Suspect to play as.
 void playerQuit(Game g, Player p)
          A player has quit the game.
 void refuted(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player has refuted the hypothesis/assertion with an unknown piece of evidence.
 void refuted(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what, Evidence by)
          The player has refuted the hypothesis/assertion with the piece of evidence.
 void spin(Game g, Player p)
          A player has spun the spinner in order to get their movement.
 void spin(Game g, Player p, int spin)
          A player has spun the spinner with the given result.
 void unableToRefute(Game g, Player p, Evidence.Suspect who, Evidence.Room where, Evidence.Weapon what)
          The player has failed to refute the hypothesis/assertion.
 void voteStart(Game g, Player p, boolean vote)
          A player has changed their vote that the game should start.
 void win(Game g, Player p)
          A player has won the game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientConnection

public ClientConnection()
Method Detail

win

public void win(Game g,
                Player p)
Description copied from interface: GameChangeListener
A player has won the game. The named player is the victor. All spoils shall inure to his or her benefit. All others must bow down and pay homage to his or her superior deductive skills.

Specified by:
win in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player that won the game

lose

public void lose(Game g,
                 Player p)
Description copied from interface: GameChangeListener
A player has lost the game. This method will not necessarily be called once for every player in the game at the end of the game, rather it is intended to be called when a player makes a failed assertion and they must then sit out the remainder of the game.

Specified by:
lose in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player that lost the game

newPlayer

public void newPlayer(Game g,
                      Player p)
Description copied from interface: GameChangeListener
A player has joined the game. The given player has just joined the given game. This method should be closely followed by a call to newPlayerSuspect or playerQuit.

Specified by:
newPlayer in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player that joined the game
See Also:
GameChangeListener.playerQuit(Game, Player), GameChangeListener.newPlayerSuspect(Game, Player, Evidence.Suspect)

playerQuit

public void playerQuit(Game g,
                       Player p)
Description copied from interface: GameChangeListener
A player has quit the game.

Specified by:
playerQuit in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player that quit the game

newPlayerSuspect

public void newPlayerSuspect(Game g,
                             Player p,
                             Evidence.Suspect s)
Description copied from interface: GameChangeListener
A player has selected a new Suspect to play as. This changes or assigns the suspect that a player will be playing as.

Specified by:
newPlayerSuspect in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is changing or assigning their suspect
s - the Suspect that the Player will now be playing as

beginTurn

public void beginTurn(Game g,
                      Player p)
Description copied from interface: GameChangeListener
A player's turn has begun. The given player is the one who is eligible to spin, make hypothesese, assertions and/or move. When called for the very first time, on the first player, this is the indication that the game has begun.

Specified by:
beginTurn in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player whose turn has just begun

endTurn

public void endTurn(Game g,
                    Player p)
Description copied from interface: GameChangeListener
A player's turn has ended. The given players turn has come to an end. The next player's turn should begin shortly.

Specified by:
endTurn in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player whose turn has just ended

spin

public void spin(Game g,
                 Player p,
                 int spin)
Description copied from interface: GameChangeListener
A player has spun the spinner with the given result. The given player has just gotten the given result on their spin of the spinner. Generally this is between 1 and 6. The player parameter may be redundant and might be removed in the future as the player is implicitly and always the 'current player'.

Specified by:
spin in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who will be able to use this spin for movement
spin - the number of 'spaces' the player will be able to move
See Also:
GameChangeListener.spin(Game, Player)

spin

public void spin(Game g,
                 Player p)
Description copied from interface: GameChangeListener
A player has spun the spinner in order to get their movement. When the spinner stops spinning, the other form of this method will be called. The player parameter may be redundant and might be removed in the future as the player is implicitly and always the 'current player'.

Specified by:
spin in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is spinning the spinner
See Also:
GameChangeListener.spin(Game, Player, int)

hypothesis

public void hypothesis(Game g,
                       Player p,
                       Evidence.Suspect who,
                       Evidence.Room where,
                       Evidence.Weapon what)
Description copied from interface: GameChangeListener
The player has posed the given hypothesis. The player parameter may be redundant and might be removed in the future as the player is implicitly and always the 'current player'.

Specified by:
hypothesis in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who posed the hypothesis
who - the Suspect that the Player, uh, suspects did it
where - the Place that the Player suspects it was done at
what - the Weapon that the Player suspects was used

assertion

public void assertion(Game g,
                      Player p,
                      Evidence.Suspect who,
                      Evidence.Room where,
                      Evidence.Weapon what)
Description copied from interface: GameChangeListener
The player is attempting to win the game. An assertion is just like a hypothesis, however the consequences are fare more dire if it is wrong.

Specified by:
assertion in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is trying to win
who - the Suspect that the Player, uh, suspects did it
where - the Place that the Player suspects it was done at
what - the Weapon that the Player suspects was used

refuted

public void refuted(Game g,
                    Player p,
                    Evidence.Suspect who,
                    Evidence.Room where,
                    Evidence.Weapon what,
                    Evidence by)
Description copied from interface: GameChangeListener
The player has refuted the hypothesis/assertion with the piece of evidence. The given piece of evidence is being used to refute the triplet of who/what/where that was posed by one of the players. The player that is referenced here is the person who is making the refutation, not the person who originally posed the hypothesis or assertion.

Specified by:
refuted in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is making the refutation
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
by - the Evidence that p is refuting with
See Also:
GameChangeListener.hypothesis(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon), GameChangeListener.assertion(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon)

refuted

public void refuted(Game g,
                    Player p,
                    Evidence.Suspect who,
                    Evidence.Room where,
                    Evidence.Weapon what)
Description copied from interface: GameChangeListener
The player has refuted the hypothesis/assertion with an unknown piece of evidence. The actual evidence that is being used to refute the hypothesis or assertion is unknown.

Specified by:
refuted in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is making the refutation
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
See Also:
GameChangeListener.hypothesis(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), GameChangeListener.assertion(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), GameChangeListener.askRefute(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), GameChangeListener.unableToRefute(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon)

move

public void move(Game g,
                 Evidence.Suspect p,
                 Location l)
Description copied from interface: GameChangeListener
A suspect has moved to a new location in the game. The given Suspect has moved to the given location. This can happen by a player moving themselves (that is, their suspect by proxy) or by a Suspect being pulled into a room for a hypothesis or assertion.

Specified by:
move in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Suspect that has been moved
l - the Location that the Suspect is now at

chat

public void chat(Game g,
                 Player p,
                 java.lang.String message)
Description copied from interface: GameChangeListener
The player has sent a public chat message. If the recipient of this event is designed in a way that would facilitate presentation of the message to a user, it ought to do so.

Specified by:
chat in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player that sent the message
message - the text of the message

askRefute

public void askRefute(Game g,
                      Player p,
                      Evidence.Suspect who,
                      Evidence.Room where,
                      Evidence.Weapon what)
Description copied from interface: GameChangeListener
The player is being asked if they can refute the evidence. When a hypothesis or assertion is made, each of the other players is, in turn, given the opportunity to refute the hypothesis. This event will be closely followed by one of the refuted methods.

Specified by:
askRefute in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is being asked to refute
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
See Also:
GameChangeListener.refuted(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon, Evidence), GameChangeListener.refuted(Game, Player, Evidence.Suspect, Evidence.Room, Evidence.Weapon)

unableToRefute

public void unableToRefute(Game g,
                           Player p,
                           Evidence.Suspect who,
                           Evidence.Room where,
                           Evidence.Weapon what)
Description copied from interface: GameChangeListener
The player has failed to refute the hypothesis/assertion. The given player was unable to refute the triplet of evidence with evidence they had available to them at this time.

Specified by:
unableToRefute in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is failing to make the refutation
who - the Suspect that the other Player, uh, suspects did it
where - the Place that the other Player suspects it was done at
what - the Weapon that the other Player suspects was used
See Also:
GameChangeListener.hypothesis(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon), GameChangeListener.assertion(edu.lmu.lmusleuth.Game, edu.lmu.lmusleuth.Player, edu.lmu.lmusleuth.Evidence.Suspect, edu.lmu.lmusleuth.Evidence.Room, edu.lmu.lmusleuth.Evidence.Weapon)

voteStart

public void voteStart(Game g,
                      Player p,
                      boolean vote)
Description copied from interface: GameChangeListener
A player has changed their vote that the game should start. This method is called when a player makes a vote one way or the other as to whether or not the game should start. When all players have voted that the game should start, the game may commence.

Specified by:
voteStart in interface GameChangeListener
Parameters:
g - the Game that this change applies to
p - the Player who is changing/setting their vote
vote - the vote, true/yes/start or false/no/don't-start.
See Also:
GameChangeListener.clearStartVotes(Game)

clearStartVotes

public void clearStartVotes(Game g)
Description copied from interface: GameChangeListener
All start votes have been set back to 'false'. Due to some change in the global game state, such as a new player joining, or a player changing suspect, all votes for the start of the game have been set back to false. It is up to each player to re-affirm their desire for the game to begin.

Specified by:
clearStartVotes in interface GameChangeListener
Parameters:
g - the Game that this change applies to