Correcions in CentralServerData: wherever a Client object wasa expected has been changed to expect a ClientHandler object. This is because the server sees clients via ClientHandlers but has no access to Client objects.
Lobby: Field "admin" added which is a ClientHandler type object. This represents who started the game and, for the phase before the gameplay starts, controls relevant functions.
This commit is contained in:
parent
5cfa6809a2
commit
ce5723c3e9
@ -3,6 +3,7 @@ package ch.unibas.dmi.dbis.cs108.sebaschi;
|
|||||||
import ch.unibas.dmi.dbis.cs108.BudaLogConfig;
|
import ch.unibas.dmi.dbis.cs108.BudaLogConfig;
|
||||||
import ch.unibas.dmi.dbis.cs108.gamelogic.Game;
|
import ch.unibas.dmi.dbis.cs108.gamelogic.Game;
|
||||||
import ch.unibas.dmi.dbis.cs108.multiplayer.client.Client;
|
import ch.unibas.dmi.dbis.cs108.multiplayer.client.Client;
|
||||||
|
import ch.unibas.dmi.dbis.cs108.multiplayer.server.ClientHandler;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -11,7 +12,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This Class Represents an Object containing different Maps, Lists and Sets wherein a server object
|
* This Class Represents an Object containing different Maps, Lists and Sets wherein a server object
|
||||||
* can find all needed data. An instance of this object can also be passed to other class-objects uf
|
* can find all needed data. An instance of this object can also be passed to other class-objects if
|
||||||
* they need the same data. This Class is used to query for information in collections.
|
* they need the same data. This Class is used to query for information in collections.
|
||||||
*/
|
*/
|
||||||
public class CentralServerData {
|
public class CentralServerData {
|
||||||
@ -19,11 +20,11 @@ public class CentralServerData {
|
|||||||
public static final Logger LOGGER = LogManager.getLogger();
|
public static final Logger LOGGER = LogManager.getLogger();
|
||||||
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
|
public static final BudaLogConfig l = new BudaLogConfig(LOGGER);
|
||||||
|
|
||||||
private Set<Client> clientsOnServer;
|
private Set<ClientHandler> clientsOnServer;
|
||||||
private Set<Game> activeGames;
|
private Set<Game> activeGames;
|
||||||
private Set<Game> gamesOpenToJoin;
|
private Set<Game> gamesOpenToJoin;
|
||||||
|
|
||||||
private Map<Client, Socket> clientSocketMap;
|
private Map<ClientHandler, Socket> clientSocketMap;
|
||||||
private Map<Socket, Client> socketClientMap;
|
private Map<Socket, ClientHandler> socketClientMap;
|
||||||
private Map<Game, Client> gameClientMap;
|
private Map<Game, ClientHandler> gameClientMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,16 @@
|
|||||||
package ch.unibas.dmi.dbis.cs108.sebaschi;
|
package ch.unibas.dmi.dbis.cs108.sebaschi;
|
||||||
|
|
||||||
|
import ch.unibas.dmi.dbis.cs108.multiplayer.server.ClientHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Lobby one is in after a client sends the CRTGM command. THe Server
|
||||||
|
*/
|
||||||
public class Lobby {
|
public class Lobby {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Person who created the game and can configure it and decide to start once enough players
|
||||||
|
* have entered the lobby.
|
||||||
|
*/
|
||||||
|
ClientHandler admin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user