Compare commits

..

No commits in common. "559afcaffd0625b7d25a1a0568d6a2264886c6bd" and "fe68d991fca959dfac5fdebe621e85acb50bd219" have entirely different histories.

20 changed files with 4 additions and 80 deletions

View File

@ -1,8 +0,0 @@
package pp.monopoly.game.client;
public class ActiveState extends ClientState{
ActiveState(ClientGameLogic logic) {
super(logic);
}
}

View File

@ -21,7 +21,6 @@ import pp.monopoly.message.server.EventDrawCard;
import pp.monopoly.message.server.GameOver;
import pp.monopoly.message.server.GameStart;
import pp.monopoly.message.server.JailEvent;
import pp.monopoly.message.server.NextPlayerTurn;
import pp.monopoly.message.server.PlayerStatusUpdate;
import pp.monopoly.message.server.ServerInterpreter;
import pp.monopoly.message.server.TimeOutWarning;
@ -55,7 +54,9 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
private final List<GameEventListener> listeners = new ArrayList<>();
private Board board;
private ClientState state = new LobbyState(this);
private ClientState state = new ClientState(this) {
};
/**
* Constructs a ClientGameLogic with the specified sender object.
@ -256,9 +257,4 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
public void received(TradeRequest msg) {
}
@Override
public void received(NextPlayerTurn msg) {
state = new ActiveState(this);
}
}

View File

@ -1,8 +0,0 @@
package pp.monopoly.game.client;
public class LobbyState extends ClientState{
LobbyState(ClientGameLogic logic) {
super(logic);
}
}

View File

@ -1,8 +0,0 @@
package pp.monopoly.game.client;
public class WaitForTurnState extends ClientState{
WaitForTurnState(ClientGameLogic logic) {
super(logic);
}
}

View File

@ -2,7 +2,6 @@ package pp.monopoly.game.server;
import java.util.LinkedList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.NoSuchElementException;
@ -143,11 +142,4 @@ public class PlayerHandler {
}
throw new NoSuchElementException("Player mit id "+id+" existiert nicht");
}
/**
* Arranges the players turns in a random order
*/
void randomOrder() {
Collections.shuffle(players);
}
}

View File

@ -13,8 +13,6 @@ import pp.monopoly.message.client.TradeOffer;
import pp.monopoly.message.client.TradeResponse;
import pp.monopoly.message.client.ViewAssetsRequest;
import pp.monopoly.message.server.GameStart;
import pp.monopoly.message.server.NextPlayerTurn;
import pp.monopoly.message.server.PlayerStatusUpdate;
import pp.monopoly.message.server.ServerMessage;
import pp.monopoly.message.server.TradeReply;
import pp.monopoly.message.server.TradeRequest;
@ -166,8 +164,7 @@ public class ServerGameLogic implements ClientInterpreter {
Player player = playerHandler.getPlayerById(from);
if (player != null && state == ServerState.INGAME) {
LOGGER.log(Level.DEBUG, "Ending turn for player {0}", player.getName());
Player next = playerHandler.nextPlayer();
send(next, new NextPlayerTurn(next));
playerHandler.nextPlayer();
}
}
@ -190,8 +187,6 @@ public class ServerGameLogic implements ClientInterpreter {
for (Player p : playerHandler.getPlayers()) {
send(p, new GameStart(playerHandler.getPlayers()));
}
playerHandler.randomOrder();
send(playerHandler.getPlayerAtIndex(0), new NextPlayerTurn(playerHandler.getPlayerAtIndex(0)));
}
}

View File

@ -1,28 +0,0 @@
package pp.monopoly.message.server;
import pp.monopoly.game.server.Player;
public class NextPlayerTurn extends ServerMessage{
private final Player player;
public NextPlayerTurn(Player player) {
this.player = player;
}
@Override
public void accept(ServerInterpreter interpreter) {
interpreter.received(this);
}
@Override
public String getInfoTextKey() {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
}
public Player getPlayer() {
return player;
}
}

View File

@ -89,11 +89,4 @@ public interface ServerInterpreter {
* @param msg the TradeRequest message received
*/
void received(TradeRequest msg);
/**
* Handles a NextPlayerTurn message received from the server.
*
* @param msg the NextPlayerTurn message received
*/
void received(NextPlayerTurn msg);
}