GUI: fix that cheat button shows for all players instead current user only (related to #5289);

This commit is contained in:
Oleg Agafonov 2020-07-29 20:22:25 +04:00
parent 7cfe39ae21
commit 1045f352bc
3 changed files with 9 additions and 3 deletions

View file

@ -31,6 +31,7 @@ public class PlayerView implements Serializable {
private final UUID playerId;
private final String name;
private final boolean controlled; // gui: player is current user
private final int life;
private final Counters counters;
private final int wins;
@ -64,6 +65,7 @@ public class PlayerView implements Serializable {
public PlayerView(Player player, GameState state, Game game, UUID createdForPlayerId, UUID watcherUserId) {
this.playerId = player.getId();
this.name = player.getName();
this.controlled = player.getId().equals(createdForPlayerId);
this.life = player.getLife();
this.counters = player.getCounters();
this.wins = player.getMatchPlayer().getWins();
@ -164,6 +166,10 @@ public class PlayerView implements Serializable {
}
}
public boolean getControlled() {
return this.controlled;
}
public int getLife() {
return this.life;
}