Fix: client verification username

This commit is contained in:
rubenpirreram
2026-05-05 13:23:43 +02:00
parent 65e88dd9fc
commit c240ef08f2
@@ -89,7 +89,10 @@ public class ClientController {
* @param pos the index of the card to draw * @param pos the index of the card to draw
*/ */
public void drawLowerTribeCard(String playerUsername,int pos) { public void drawLowerTribeCard(String playerUsername,int pos) {
client.doEvent(new DrawLowerTribeCard(playerUsername,pos)); if(!Objects.equals(playerUsername, localController.getModel().getCurrentState().getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else
client.doEvent(new DrawLowerTribeCard(playerUsername,pos));
} }
@@ -140,8 +143,9 @@ public class ClientController {
* This action is available only when the lower list is empty or the player cannot draw any card. * This action is available only when the lower list is empty or the player cannot draw any card.
* @param playerUsername the name of the player performing the action * @param playerUsername the name of the player performing the action
*/ */
public void skipLower(String playerUsername) { if(!Objects.equals(playerUsername, localController.getModel().getCurrentState().getCurrentPlayer().getUserName())) public void skipLower(String playerUsername) {
view.showError("It's not your turn!"); if(!Objects.equals(playerUsername, localController.getModel().getCurrentState().getCurrentPlayer().getUserName()))
view.showError("It's not your turn!");
else else
client.doEvent(new SkipLower(playerUsername));} client.doEvent(new SkipLower(playerUsername));}