i have been debugging during the last hours over hours, but i did not get it....
i am sending an object from a Java Socket Server to a client (game server and game client), and it seemed that there was an issue while delivering the object....
server side:
//this is the controller function
public static void sendToAllPlayers(Object o){
for (Connection c : NetworkService.getActiveConnections()){
//i will explain this function below
NetworkService.send(c, o);
}
}
//this is the call to the controller
NetworkController.sendToAllPlayers(new SynchronizeMatch(MatchService.getMatchStore(), RoundService.getRoundStore()));
inside of the MatchStore ( => MatchService.getMatchStore()
) there are all players listed. A player looks like:
class Player implements Serializable {
private String username;
private Integer points;
......
}
the issue was, that the field "points" was not delivered correctly from the server to the client. Client side:
Object object = in.readObject();
if (object instanceof SynchronizeMatch){
SynchronizeMatch syncMatch = (SynchronizeMatch) object;
MatchController.setMatchStore(syncMatch.getMatchStore);
......
}
so far everything worked fine - the match store (and the round store as well) kept all of the "live data" of the game, except the point level of the players. It was not updated correctly. And now the send() function:
public static void send(Connection c, Object o){
try {
c.getObjectOutputStream().writeObject(o);
} catch (IOException e) {
e.printStackTrace();
}
}
i post the answer below