Merge branch 'main' into Fix-tests-and-javadoc-idIMG

This commit is contained in:
rubenpirreram
2026-05-07 15:02:12 +02:00
committed by GitHub
14 changed files with 183 additions and 251 deletions
@@ -17,9 +17,8 @@ public interface IClient {
public void drawLowerBuildingCard(String playerUsername,int pos) throws RemoteException;
public void skipUpper(String playerUsername) throws RemoteException;
public void skipTurn(String playerUsername) throws RemoteException;
public void skipLower(String playerUsername) throws RemoteException;
public void pickOptionalTribeCard(String playerUsername,int pos) throws RemoteException;
@@ -3,31 +3,30 @@ package it.polimi.ingsw.gc14.Network.NetworkEvents;
import it.polimi.ingsw.gc14.Controller.GameController;
import it.polimi.ingsw.gc14.Network.EventType;
import it.polimi.ingsw.gc14.Network.NetworkEvent;
import it.polimi.ingsw.gc14.View.IView;
import java.io.Serializable;
/**
* NetworkEvent to avoid drawing a card from the lower card list
*/
public class SkipLower extends NetworkEvent implements Serializable{
public class SkipNoDrawable extends NetworkEvent implements Serializable{
/**
* Class constructor.
* Initializes all the attributes.
* @param username the name of the player requesting the event
*/
public SkipLower(String username){
public SkipNoDrawable(String username){
super(username, EventType.SKIP_LOWER, false);
}
/**
* @param gameController the Game Controller on which to apply the event
* @return true if the player could draw the card, false otherwise
* @return true if the player could skipTheTurn, false otherwise
*/
@Override
public boolean apply(GameController gameController){
return gameController.SkipLowerDrawing(username);
return gameController.SkipNoDrawable(username);
}
}
@@ -1,33 +0,0 @@
package it.polimi.ingsw.gc14.Network.NetworkEvents;
import it.polimi.ingsw.gc14.Controller.GameController;
import it.polimi.ingsw.gc14.Network.EventType;
import it.polimi.ingsw.gc14.Network.NetworkEvent;
import it.polimi.ingsw.gc14.View.IView;
import java.io.Serializable;
/**
* NetworkEvent to avoid drawing a card from the upper card list
*/
public class SkipUpper extends NetworkEvent implements Serializable{
/**
* Class constructor.
* Initializes all the attributes.
* @param username the name of the player requesting the event
*/
public SkipUpper(String username){
super(username, EventType.SKIP_UPPER, false);
}
/**
* @param gameController the Game Controller on which to apply the event
* @return true if the player could draw the card, false otherwise
*/
@Override
public boolean apply(GameController gameController){
return gameController.SkipUpperDrawing(username);
}
}
@@ -121,23 +121,15 @@ public class RMIClient implements IClient {
/**
* Requests to skip drawing from the upper list.
* This action is available only when the upper list is empty or the player cannot draw any card.
* Requests to skip the turn.
* This action is available only when the player cannot draw any tribe card, but still can buy some buildings.
* @param playerUsername the name of the player performing the action
*/
public void skipUpper(String playerUsername) throws RemoteException {
stub.skipUpper(playerUsername);
public void skipTurn(String playerUsername) throws RemoteException {
stub.skipTurn(playerUsername);
}
/**
* Requests to skip drawing from the lower list.
* 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
*/
public void skipLower(String playerUsername) throws RemoteException {
stub.skipLower(playerUsername);
}
/**
@@ -39,9 +39,8 @@ public interface IGameServer extends Remote {
void drawLowerBuildingCard(String playerUsername,int pos) throws RemoteException;
void skipUpper(String playerUsername) throws RemoteException;
void skipTurn(String playerUsername) throws RemoteException;
void skipLower(String playerUsername) throws RemoteException;
void pickOptionalTribeCard(String playerUsername,int pos) throws RemoteException;
@@ -8,14 +8,11 @@ import it.polimi.ingsw.gc14.Network.NetworkEvents.*;
import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback;
import it.polimi.ingsw.gc14.Network.RMI.Common.IGameServer;
import java.net.InetAddress;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
@@ -156,24 +153,15 @@ public class RMIServer extends UnicastRemoteObject implements IGameServer {
/**
* Requests to skip drawing from the upper list.
* This action is available only when the upper list is empty or the player cannot draw any card.
* Requests to skip the turn.
* This action is available only when the player cannot draw any tribe card, but still can buy some buildings.
* @param playerUsername the name of the player performing the action
*/
public void skipUpper(String playerUsername) {
actionQueue.offer(new SkipUpper(playerUsername));
public void skipTurn(String playerUsername) {
actionQueue.offer(new SkipNoDrawable(playerUsername));
}
/**
* Requests to skip drawing from the lower list.
* 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
*/
public void skipLower(String playerUsername) {
actionQueue.offer(new SkipLower(playerUsername));
}
/**
* Used to draw a tribe card from the upper list.
@@ -159,23 +159,14 @@ public class TCPClient implements IClient {
}
/**
* Requests to skip drawing from the upper list.
* This action is available only when the upper list is empty or the player cannot draw any card.
* @param playerUsername the name of the player performing the action
*/
public void skipUpper(String playerUsername) {
doEvent(new SkipUpper(playerUsername));
}
/**
* Requests to skip drawing from the lower list.
* This action is available only when the lower list is empty or the player cannot draw any card.
* Requests to skip drawing turn.
* This action is available only when the player cannot draw any tribe card, but still can buy some buildings.
* @param playerUsername the name of the player performing the action
*/
public void skipLower(String playerUsername) {
doEvent(new SkipLower(playerUsername));
public void skipTurn(String playerUsername) {
doEvent(new SkipNoDrawable(playerUsername));
}