package dod; import java.io.PrintWriter; import dod.game.CommandException; import dod.game.CompassDirection; import dod.game.GameLogic; import dod.game.Player; public class ClientServerController { public ClientServerController() { } public void ServerToClientMessage(PrintWriter output, String message) { output.println(message); output.flush(); } public void ClientToClientMessage(ClientGUI clientGUI, String serverReply) { clientGUI.OutputSent(serverReply); } public void addGame(PlayerGuide playerGuide, GameLogic game, ClientThread thread) { game.addPlayer(playerGuide, thread); } public void die(GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); game.die(player); } public void playerleft(GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); game.playerleft(player); } public void clientHello(GameLogic game, String name, ClientThread thread) { game.clientHello(game, name, thread); } public void clientPickup(GameLogic game, ClientThread thread) { game.clientPickup(thread); } public void clientMove(Object direction, GameLogic game, ClientThread thread) { game.clientMove(direction, thread); } public void checkChange(GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); game.checkChange(player); } public void advanceTurn(GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); game.advanceTurn(player); } public void clientCHAT(GameLogic game, String arg) { game.clientCHAT(arg); } public void clientAttack(CompassDirection direction, GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); try { game.clientAttack(direction, player); } catch (CommandException e) { System.out.println(e.getMessage()); } } public void clientEndTurn(GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); game.clientEndTurn(player); } public void clientShout(String sanitiseMessage, GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); game.clientShout(sanitiseMessage, player); } public String clientLook(GameLogic game, ClientThread thread) { Player player = game.getPlayerThreadMap(thread); String reply = game.clientLook(player); return reply; } }