Skip to content
Snippets Groups Projects
IComToData.java 2.1 KiB
Newer Older
package baleine.common.interfaces.server;

import java.util.ArrayList;
import java.util.UUID;

import com.sun.jmx.snmp.Timestamp;

import baleine.common.dataModel.GameLight;
import baleine.common.dataModel.Message;
import baleine.common.dataModel.Move;
import baleine.common.dataModel.UserLight;

/**
 * IComToData This class is an interface which provides server methods to
 * communicate from Com to Data modules.
 */
public interface IComToData {

	/**
	 * Requests a player by its UUID.
	 * 
	 * @param playerID : the UUID of the player to retrieve
	 */
	public void requestPlayerByUUID(UUID playerID);
	/**
	 * Adds a new user to the list.
	 * 
	 * @param userLight : the user to add
	 */
	public void addNewUser(UserLight userLight);
	/**
	 * Create a new game.
	 * 
	 * @param gameLight : the game to create
	 */
	public void createGame(GameLight gameLight);
	/**
	 * Request saving a game by UUID.
	 * 
	 * @param gameID : the UUID of the game to save
	 */
	public void requestGameSave(UUID gameID);
	/**
	 * Receive a new chat message to transfer it.
	 * 
	 * @param message   : the message to transfer
	 * @param timestamp : the timestamp of the message
	 * @param userID    : the UUID of the user sending the message
	 * @param gameID    : the UUID of the game in which the message was sent
	 * @return the message to transfer
	 */
	public Message receiveNewChatMessage(String message, Timestamp timestamp, UUID userID, UUID gameID);
	/**
	 * Get all the participants (players & spectators) of a game.
	 * 
	 * @param gameID : the UUID of the game
	 * @return the list of users
	 */
	public ArrayList<UUID> getAllGameParticipants(UUID gameID);
	/**
	 * Notifies that a user has been disconnected.
	 * 
	 * @param userID : the UUID of the disconnected user
	 */
	public void disconnectUser(UUID userID);
	/**
	 * Adds a spectator to a game.
	 * 
	 * @param gameLight : the game concerned
	 * @param userLight : the user to add as spectator
	 */
	public void addSpectator(GameLight gameLight, UserLight userLight);

	/**
	 * Send a move to the data module.
	 * 
	 * @param move : the move to send
	 */
	public void sendMove(Move move);