Package pacManReloaded.server
Class Lobby
- java.lang.Object
-
- pacManReloaded.server.Lobby
-
public class Lobby extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddPlayer(ServerThread thread)method to add a player to the lobbyjava.lang.StringgetName()getter for the name of the lobbyjava.util.ArrayList<Player>getPlayers()"getter" of the playersvoidgetServerTicks()messure of the server ticks in milli seconds, counts them to be able to analyse themLobbyStategetState()"getter" for the state of the lobbyvoidhandleChangeDir(java.lang.String changeDirMsg, ServerThread thread)handles the changing of each players moving directionvoidhandleMessage(IMessage gameMsg, ServerThread thread)handles messages of the gamebooleanhasPlayer(java.lang.String playerName)method to check if the lobby contains playervoidremovePlayer(ServerThread thread)method to remove a player from the servervoidsetState(LobbyState state)"setter" for the state of the lobby
-
-
-
Constructor Detail
-
Lobby
public Lobby(java.lang.String name, Server server)Constructor of the Lobby- Parameters:
name- name of the lobbyserver- server the lobby is connected to
-
-
Method Detail
-
getName
public java.lang.String getName()
getter for the name of the lobby- Returns:
- name of the lobby
-
getState
public LobbyState getState()
"getter" for the state of the lobby- Returns:
- state of the lobby
-
setState
public void setState(LobbyState state)
"setter" for the state of the lobby- Parameters:
state- lobby status
-
hasPlayer
public boolean hasPlayer(java.lang.String playerName)
method to check if the lobby contains player- Parameters:
playerName- nickname of the player- Returns:
- true if there are players in the lobby, else (if lobby is empty) false
-
addPlayer
public boolean addPlayer(ServerThread thread)
method to add a player to the lobby- Parameters:
thread- thread of the server- Returns:
- true if player was added (if players in lobby are less than 4), else (if there are or more players in a lobby) false
-
removePlayer
public void removePlayer(ServerThread thread)
method to remove a player from the server- Parameters:
thread- thread of the server
-
handleMessage
public void handleMessage(IMessage gameMsg, ServerThread thread)
handles messages of the game- Parameters:
gameMsg- message of the gamethread- thread of the server
-
handleChangeDir
public void handleChangeDir(java.lang.String changeDirMsg, ServerThread thread)handles the changing of each players moving direction- Parameters:
changeDirMsg- message with the informations about the directionthread- the thread of the server
-
getPlayers
public java.util.ArrayList<Player> getPlayers()
"getter" of the players- Returns:
- all players
-
getServerTicks
public void getServerTicks()
messure of the server ticks in milli seconds, counts them to be able to analyse them
-
-