Getting information about connected players in Mage Client (without gui part at the moment, only logging to console).

This commit is contained in:
magenoxx 2011-05-13 20:25:46 +04:00
parent f55e3a88dd
commit 54adc043ec
5 changed files with 47 additions and 1 deletions

View file

@ -322,6 +322,18 @@ public class Session {
}
}
public Collection<String> getConnectedPlayers(UUID roomId) throws MageRemoteException {
try {
return server.getConnectedPlayers(roomId);
} catch (RemoteException ex) {
handleRemoteException(ex);
throw new MageRemoteException();
} catch (MageException ex) {
handleMageException(ex);
throw new MageRemoteException();
}
}
public TournamentView getTournament(UUID tournamentId) throws MageRemoteException {
try {
return server.getTournament(tournamentId);

View file

@ -432,6 +432,8 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
private UUID roomId;
private TablesPanel panel;
private final static Logger logger = Logging.getLogger(TablesPanel.class.getName());
UpdateTablesTask(Session session, UUID roomId, TablesPanel panel) {
this.session = session;
this.roomId = roomId;
@ -442,6 +444,10 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
protected Void doInBackground() throws Exception {
while (!isCancelled()) {
this.publish(session.getTables(roomId));
logger.info("connected players:");
for (String player : session.getConnectedPlayers(roomId)) {
logger.info(" " + player);
}
Thread.sleep(1000);
}
return null;