fixed bugs so the programm would start and added some Todo where code is missing or was fraudulent

This commit is contained in:
Hanno Fleischer
2024-11-27 09:19:57 +01:00
parent 20c9000d56
commit c9362a7a95
7 changed files with 31 additions and 15 deletions

View File

@@ -182,6 +182,11 @@ public void received(WaitPiece msg) {
state.received(msg);
}
@Override
public void received(Spectator msg) {
state.received(msg);
}
public void selectPiece(UUID pieceId){
state.selectPiece(pieceId);
}

View File

@@ -163,6 +163,11 @@ public void received(UpdateTSK msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(Spectator msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(WaitPiece msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);

View File

@@ -139,7 +139,7 @@ public int getNumberOfActivePlayers() {
*/
public void notifyObservers() {
for (Observer observer : new ArrayList<>(observers)) {
observer.update();
//observer.update();
}
}

View File

@@ -11,7 +11,7 @@ public class UpdateReady extends ServerMessage {
/**
* The color associated with the update.
*/
private final Color color;
private final int playerId;
/**
* Indicates whether the player is ready.
@@ -21,12 +21,12 @@ public class UpdateReady extends ServerMessage {
/**
* Constructs a new UpdateReady instance with the specified color and readiness status.
*
* @param color the color associated with the update
* @param playerId the playerId associated with the update
* @param ready the readiness status
*/
public UpdateReady(Color color, boolean ready) {
public UpdateReady(int playerId, boolean ready) {
super();
this.color = color;
this.playerId = playerId;
this.ready = ready;
}
@@ -35,17 +35,17 @@ public UpdateReady(Color color, boolean ready) {
*/
private UpdateReady() {
super();
this.color = null;
this.playerId = 0;
this.ready = false;
}
/**
* Gets the color associated with the update.
* Gets the playerId associated with the update.
*
* @return the color
* @return the playerId
*/
public Color getColor() {
return color;
public int getPlayerId() {
return playerId;
}
/**

View File

@@ -81,7 +81,7 @@ public void received(LobbyNotReady msg, int from) {
* @param from as the client id of the player as an Integer.
*/
@Override
public void received(ForceStartGame msg, int from) {
public void received(StartGame msg, int from) {
this.logic.getServerSender().broadcast(new ServerStartGame());
this.logic.setCurrentState(this.logic.getGameState());
}