public class User extends java.lang.Object implements Player, java.io.Serializable
jpleal@fc.up.pt
Constructor and Description |
---|
User(java.lang.String nick,
java.lang.String password)
Instantiates a user with given nick and password.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
authenticate(java.lang.String password)
Checks if given password authenticates this user.
|
(package private) byte[] |
digest(java.lang.String password)
Converts a passwords in a byte array using a MD5 digest
(
MessageDigest ,
MessageDigest.digest() ). |
java.lang.String |
getNick()
Players nick, it will used as an ID.
|
(package private) java.util.List<GameEvent> |
getRecentEvents()
A list of pending events received by this user.
|
void |
notify(GameEndEvent event)
Notify the observer that the game has ended.
|
void |
notify(RoundConclusionEvent event)
Notify the observer of the round conclusion.
|
void |
notify(RoundUpdateEvent event)
Notify the observer of updates in a round.
|
void |
notify(SendCardsEvent event)
Notify the observer and send her/him/it a list of cards.
|
User(java.lang.String nick, java.lang.String password)
nick
- of user.password
- of user.boolean authenticate(java.lang.String password)
password
- to check.true
if passwords match; false
otherwise.byte[] digest(java.lang.String password)
MessageDigest
,
MessageDigest.digest()
).password
- to digest.public java.lang.String getNick()
Player
public void notify(SendCardsEvent event)
GameObserver
notify
in interface GameObserver
event
- to send.public void notify(RoundUpdateEvent event)
GameObserver
notify
in interface GameObserver
event
- to send.public void notify(RoundConclusionEvent event)
GameObserver
notify
in interface GameObserver
event
- to send.public void notify(GameEndEvent event)
GameObserver
notify
in interface GameObserver
event
- to send.java.util.List<GameEvent> getRecentEvents()