forked from External/mage
Ban ignored users from watching
This commit bans ignored users from watching games where the creator has them on their ignore list.
This commit is contained in:
parent
62c14a9c24
commit
ad0507e739
8 changed files with 60 additions and 19 deletions
|
|
@ -879,14 +879,23 @@ public class MageServerImpl implements MageServer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void watchGame(final UUID gameId, final String sessionId) throws MageException {
|
||||
execute("watchGame", sessionId, () -> {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
GameManager.instance.watchGame(gameId, userId);
|
||||
public boolean watchGame(final UUID gameId, final String sessionId) throws MageException {
|
||||
return executeWithResult("watchGame", sessionId, new ActionWithResult<Boolean>() {
|
||||
@Override
|
||||
public Boolean execute() throws MageException {
|
||||
Optional<Session> session = SessionManager.instance.getSession(sessionId);
|
||||
if (!session.isPresent()) {
|
||||
logger.error("Session not found : " + sessionId);
|
||||
return false;
|
||||
} else {
|
||||
UUID userId = session.get().getUserId();
|
||||
return GameManager.instance.watchGame(gameId, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean negativeResult() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue