From 855f3bb399c1390fa881ecd99c012e4087b47ded Mon Sep 17 00:00:00 2001 From: "MELLON\\wroot" Date: Sun, 20 Dec 2020 23:03:51 +0300 Subject: [PATCH] Offer popup bug fix. --- src/models/Agreement.java | 3 +++ src/models/Game.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/models/Agreement.java b/src/models/Agreement.java index 4693712..eb39ca6 100644 --- a/src/models/Agreement.java +++ b/src/models/Agreement.java @@ -118,6 +118,9 @@ public Player getFirstPlayer(){ return firstPlayer; } + // get second player + public Player getSecondPlayer() { return secondPlayer; } + // get id public String getName() { return name; } diff --git a/src/models/Game.java b/src/models/Game.java index 151d614..b2eadef 100644 --- a/src/models/Game.java +++ b/src/models/Game.java @@ -125,7 +125,7 @@ public int getPlayerNumber(){ public Agreement offerAgreement(){ for(Agreement agreement: agreements){ - if(!agreement.isOffered()){ + if(!agreement.isOffered() && (agreement.getSecondPlayer().getId() == currentPlayer)){ return agreement; } }