java.lang.Object
it.polimi.ingsw.network.server.User
public class User
extends java.lang.Object
The entity connecting to the server; can be used to keep a game history or something similar
-
Constructor Summary
Constructors Constructor Description User(VirtualClient virtualClient, Server server)
Default constructor -
Method Summary
Modifier and Type Method Description void
closeConnection()
Ends the connection between the server and clientLobby
getRoom()
Provides the lobby in which the user is currently injava.lang.String
getUsername()
username gettervoid
notify(Message message)
Sends a message to the clientvoid
setUsername(java.lang.String username)
username setter
-
Constructor Details
-
User
Default constructorWhen created, a user is associated to a virtualClient, which handles all its requests
- Parameters:
virtualClient
- the virtualClient associated to the userserver
- the server reference
-
-
Method Details
-
getUsername
public java.lang.String getUsername()username getter- Returns:
- the user's username
-
setUsername
public void setUsername(java.lang.String username)username setter- Parameters:
username
- the user's username
-
notify
Sends a message to the client- Parameters:
message
- the message to send
-
closeConnection
public void closeConnection()Ends the connection between the server and client -
getRoom
Provides the lobby in which the user is currently in- Returns:
- the Lobby object where this user is contained
-