Removed all unnecessary server messages place
This commit is contained in:
parent
0b465ab800
commit
b045225a81
@ -23,8 +23,8 @@ public class ClientGameInfoHandler {
|
|||||||
public static final String gameOverGhostsWin = "Game over, ghosts win!";
|
public static final String gameOverGhostsWin = "Game over, ghosts win!";
|
||||||
|
|
||||||
//relevant for gui
|
//relevant for gui
|
||||||
public static final String itsNightTime = "Please wait, ghosts are active";
|
public static final String itsNightTime = "Listen closely, ghosts are active...";
|
||||||
public static final String itsDayTime = "Please wait, humans are active";
|
public static final String itsDayTime = "The humans are looking for you!";
|
||||||
|
|
||||||
//just messages
|
//just messages
|
||||||
|
|
||||||
|
|||||||
@ -432,8 +432,9 @@ public class Client {
|
|||||||
try {
|
try {
|
||||||
if (data.contains("Game over")) {
|
if (data.contains("Game over")) {
|
||||||
chatApp.getGameController().addMessageToNotificationText(data);
|
chatApp.getGameController().addMessageToNotificationText(data);
|
||||||
|
} else if (!data.contains("$") && !data.contains("nickname")) {
|
||||||
|
chatApp.getChatController().addChatMsgToServerView(data);
|
||||||
}
|
}
|
||||||
chatApp.getChatController().addChatMsgToServerView(data);
|
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
chatApp.getGameController().clearNotificationText();
|
chatApp.getGameController().clearNotificationText();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|||||||
@ -42,7 +42,6 @@ public class JClientProtocolParser {
|
|||||||
System.out.println(msg.substring(6));
|
System.out.println(msg.substring(6));
|
||||||
if (!msg.substring(6).equals("Your vote was invalid")) {
|
if (!msg.substring(6).equals("Your vote was invalid")) {
|
||||||
c.notificationTextDisplay(msg.substring(6));
|
c.notificationTextDisplay(msg.substring(6));
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Protocol.printToClientChat:
|
case Protocol.printToClientChat:
|
||||||
|
|||||||
@ -129,10 +129,7 @@ public class ClientHandler implements Runnable {
|
|||||||
String helper = this.getClientUserName();
|
String helper = this.getClientUserName();
|
||||||
String oldName = getClientUserName();
|
String oldName = getClientUserName();
|
||||||
this.clientUserName = nameDuplicateChecker.checkName(newName);
|
this.clientUserName = nameDuplicateChecker.checkName(newName);
|
||||||
guiUpdateAll(Protocol.printToGUI + "$" + GuiParameters.nameChanged + "$" + oldName + ":"
|
|
||||||
+ getClientUserName());
|
|
||||||
sendMsgToClient(Protocol.changedUserName + "$" + newName);
|
sendMsgToClient(Protocol.changedUserName + "$" + newName);
|
||||||
|
|
||||||
broadcastAnnouncementToAll(helper + " has changed their nickname to " + clientUserName);
|
broadcastAnnouncementToAll(helper + " has changed their nickname to " + clientUserName);
|
||||||
try {
|
try {
|
||||||
getLobby().getGame().getGameState().changeUsername(helper, newName);
|
getLobby().getGame().getGameState().changeUsername(helper, newName);
|
||||||
@ -250,12 +247,6 @@ public class ClientHandler implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void guiUpdateAll(String msg) {
|
|
||||||
System.out.println(msg);
|
|
||||||
for (ClientHandler client : connectedClients) {
|
|
||||||
client.sendMsgToClient(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcasts a non-chat Message to all clients in the same lobby. This can be used for server
|
* Broadcasts a non-chat Message to all clients in the same lobby. This can be used for server
|
||||||
@ -476,9 +467,6 @@ public class ClientHandler implements Runnable {
|
|||||||
public void createNewLobby() {
|
public void createNewLobby() {
|
||||||
if (Lobby.clientIsInLobby(this) == -1) {
|
if (Lobby.clientIsInLobby(this) == -1) {
|
||||||
Lobby newGame = new Lobby(this);
|
Lobby newGame = new Lobby(this);
|
||||||
guiUpdateAll(
|
|
||||||
Protocol.printToGUI + "$" + GuiParameters.newLobbyCreated + "$" + getLobby().getLobbyID()
|
|
||||||
+ ":" + getClientUserName());
|
|
||||||
LOGGER.debug("Lobby: " + getLobby().getLobbyID() + ". In method createNewLobby()");
|
LOGGER.debug("Lobby: " + getLobby().getLobbyID() + ". In method createNewLobby()");
|
||||||
} else {
|
} else {
|
||||||
sendAnnouncementToClient("You are already in lobby nr. " + Lobby.clientIsInLobby(this));
|
sendAnnouncementToClient("You are already in lobby nr. " + Lobby.clientIsInLobby(this));
|
||||||
@ -496,8 +484,6 @@ public class ClientHandler implements Runnable {
|
|||||||
if (l != null) {
|
if (l != null) {
|
||||||
if (l.getLobbyIsOpen()) {
|
if (l.getLobbyIsOpen()) {
|
||||||
l.addPlayer(this);
|
l.addPlayer(this);
|
||||||
guiUpdateAll(Protocol.printToGUI + "$" + GuiParameters.addNewMemberToLobby + "$" + i + ":"
|
|
||||||
+ getClientUserName());
|
|
||||||
} else {
|
} else {
|
||||||
sendAnnouncementToClient("The game in Lobby " + l.getLobbyID()
|
sendAnnouncementToClient("The game in Lobby " + l.getLobbyID()
|
||||||
+ " has already started, or the lobby is already full.");
|
+ " has already started, or the lobby is already full.");
|
||||||
@ -518,8 +504,6 @@ public class ClientHandler implements Runnable {
|
|||||||
l.removePlayer(this);
|
l.removePlayer(this);
|
||||||
Game game = l.getGame();
|
Game game = l.getGame();
|
||||||
if(l.getAdmin().equals(getClientUserName())){
|
if(l.getAdmin().equals(getClientUserName())){
|
||||||
//Lobby closed because admin left. Lobby must be removed from gui view
|
|
||||||
guiUpdateAll(Protocol.printToGUI+"$"+GuiParameters.removeLobby+"$"+l.getLobbyID());
|
|
||||||
}else{
|
}else{
|
||||||
//client just leaves lobby
|
//client just leaves lobby
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,8 +65,6 @@ public class JServerProtocolParser {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
h.setUsernameOnLogin("U.N. Owen");
|
h.setUsernameOnLogin("U.N. Owen");
|
||||||
}
|
}
|
||||||
h.guiUpdateAll(Protocol.printToGUI + "$" + GuiParameters.newPlayerOnServer + "$"
|
|
||||||
+ h.getClientUserName());
|
|
||||||
break;
|
break;
|
||||||
case Protocol.nameChange:
|
case Protocol.nameChange:
|
||||||
h.changeUsername(msg.substring(6));
|
h.changeUsername(msg.substring(6));
|
||||||
@ -92,9 +90,6 @@ public class JServerProtocolParser {
|
|||||||
break;
|
break;
|
||||||
case Protocol.createNewLobby:
|
case Protocol.createNewLobby:
|
||||||
h.createNewLobby();
|
h.createNewLobby();
|
||||||
h.guiUpdateAll(
|
|
||||||
Protocol.printToGUI + "$" + GuiParameters.newLobbyCreated + "$" + h.getLobby()
|
|
||||||
.getLobbyID() + ":" + h.getClientUserName());
|
|
||||||
LOGGER.info("Here");
|
LOGGER.info("Here");
|
||||||
break;
|
break;
|
||||||
case Protocol.listLobbies:
|
case Protocol.listLobbies:
|
||||||
|
|||||||
Reference in New Issue
Block a user