Added ignores
This commit is contained in:
@@ -39,6 +39,10 @@ public class DaoBuilder {
|
||||
objectMap.put(LeagueDAO.class, new DbLeagueDAO(dbAccess));
|
||||
objectMap.put(GameHistoryDAO.class, new DbGameHistoryDAO(dbAccess));
|
||||
|
||||
DbIgnoreDAO dbIgnoreDao = new DbIgnoreDAO(dbAccess);
|
||||
CachedIgnoreDAO ignoreDao = new CachedIgnoreDAO(dbIgnoreDao);
|
||||
objectMap.put(IgnoreDAO.class, ignoreDao);
|
||||
|
||||
DbDeckDAO dbDeckDao = new DbDeckDAO(dbAccess, library);
|
||||
CachedDeckDAO deckDao = new CachedDeckDAO(dbDeckDao);
|
||||
objectMap.put(DeckDAO.class, deckDao);
|
||||
|
||||
@@ -89,7 +89,8 @@ public class ServerBuilder {
|
||||
extract(objectMap, CollectionsManager.class),
|
||||
extract(objectMap, CardSets.class)));
|
||||
|
||||
objectMap.put(ChatServer.class, new ChatServer());
|
||||
objectMap.put(ChatServer.class, new ChatServer(
|
||||
extract(objectMap, IgnoreDAO.class)));
|
||||
|
||||
objectMap.put(LotroServer.class,
|
||||
new LotroServer(
|
||||
@@ -100,6 +101,7 @@ public class ServerBuilder {
|
||||
|
||||
objectMap.put(HallServer.class,
|
||||
new HallServer(
|
||||
extract(objectMap, IgnoreDAO.class),
|
||||
extract(objectMap, LotroServer.class),
|
||||
extract(objectMap, ChatServer.class),
|
||||
extract(objectMap, LeagueService.class),
|
||||
|
||||
@@ -6,11 +6,13 @@ public class ChatMessage {
|
||||
private Date _when;
|
||||
private String _from;
|
||||
private String _message;
|
||||
private boolean fromAdmin;
|
||||
|
||||
public ChatMessage(Date when, String from, String message) {
|
||||
public ChatMessage(Date when, String from, String message, boolean fromAdmin) {
|
||||
_when = when;
|
||||
_from = from;
|
||||
_message = message;
|
||||
this.fromAdmin = fromAdmin;
|
||||
}
|
||||
|
||||
public String getFrom() {
|
||||
@@ -24,4 +26,8 @@ public class ChatMessage {
|
||||
public Date getWhen() {
|
||||
return _when;
|
||||
}
|
||||
|
||||
public boolean isFromAdmin() {
|
||||
return fromAdmin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ public class ChatRoom {
|
||||
_muteJoinPartMessages = muteJoinPartMessages;
|
||||
}
|
||||
|
||||
private void postMessage(String from, String message, boolean addToHistory) {
|
||||
ChatMessage chatMessage = new ChatMessage(new Date(), from, message);
|
||||
public void postMessage(String from, String message, boolean addToHistory, boolean fromAdmin) {
|
||||
ChatMessage chatMessage = new ChatMessage(new Date(), from, message, fromAdmin);
|
||||
if (addToHistory) {
|
||||
_lastMessages.add(chatMessage);
|
||||
shrinkLastMessages();
|
||||
@@ -28,8 +28,12 @@ public class ChatRoom {
|
||||
listeners.getValue().messageReceived(chatMessage);
|
||||
}
|
||||
|
||||
public void postMessage(String from, String message) {
|
||||
postMessage(from, message, true);
|
||||
public void postToUser(String from, String to, String message) {
|
||||
ChatMessage chatMessage = new ChatMessage(new Date(), from, message, false);
|
||||
final ChatRoomListener chatRoomListener = _chatRoomListeners.get(to);
|
||||
if (chatRoomListener != null) {
|
||||
chatRoomListener.messageReceived(chatMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public void joinChatRoom(String playerId, ChatRoomListener listener) {
|
||||
@@ -38,13 +42,13 @@ public class ChatRoom {
|
||||
for (ChatMessage lastMessage : _lastMessages)
|
||||
listener.messageReceived(lastMessage);
|
||||
if (!wasInRoom && !_muteJoinPartMessages)
|
||||
postMessage("System", playerId + " joined the room", false);
|
||||
postMessage("System", playerId + " joined the room", true, false);
|
||||
}
|
||||
|
||||
public void partChatRoom(String playerId) {
|
||||
boolean wasInRoom = (_chatRoomListeners.remove(playerId) != null);
|
||||
if (wasInRoom && !_muteJoinPartMessages)
|
||||
postMessage("System", playerId + " left the room", false);
|
||||
postMessage("System", playerId + " left the room", true, false);
|
||||
}
|
||||
|
||||
public Collection<String> getUsersInRoom() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.chat;
|
||||
|
||||
import com.gempukku.lotro.PrivateInformationException;
|
||||
import com.gempukku.lotro.SubscriptionExpiredException;
|
||||
import com.gempukku.lotro.db.IgnoreDAO;
|
||||
import com.gempukku.lotro.game.ChatCommunicationChannel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@@ -10,6 +11,7 @@ import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
public class ChatRoomMediator {
|
||||
private IgnoreDAO ignoreDAO;
|
||||
private Logger _logger;
|
||||
private ChatRoom _chatRoom;
|
||||
|
||||
@@ -22,11 +24,12 @@ public class ChatRoomMediator {
|
||||
|
||||
private Map<String, ChatCommandCallback> _chatCommandCallbacks = new HashMap<String, ChatCommandCallback>();
|
||||
|
||||
public ChatRoomMediator(String roomName, boolean muteJoinPartMessages, int secondsTimeoutPeriod) {
|
||||
this(roomName, muteJoinPartMessages, secondsTimeoutPeriod, null);
|
||||
public ChatRoomMediator(IgnoreDAO ignoreDAO, String roomName, boolean muteJoinPartMessages, int secondsTimeoutPeriod) {
|
||||
this(ignoreDAO, roomName, muteJoinPartMessages, secondsTimeoutPeriod, null);
|
||||
}
|
||||
|
||||
public ChatRoomMediator(String roomName, boolean muteJoinPartMessages, int secondsTimeoutPeriod, Set<String> allowedPlayers) {
|
||||
public ChatRoomMediator(IgnoreDAO ignoreDAO, String roomName, boolean muteJoinPartMessages, int secondsTimeoutPeriod, Set<String> allowedPlayers) {
|
||||
this.ignoreDAO = ignoreDAO;
|
||||
_logger = Logger.getLogger("chat."+roomName);
|
||||
_allowedPlayers = allowedPlayers;
|
||||
_channelInactivityTimeoutPeriod = 1000 * secondsTimeoutPeriod;
|
||||
@@ -43,7 +46,7 @@ public class ChatRoomMediator {
|
||||
if (!admin && _allowedPlayers != null && !_allowedPlayers.contains(playerId))
|
||||
throw new PrivateInformationException();
|
||||
|
||||
ChatCommunicationChannel value = new ChatCommunicationChannel();
|
||||
ChatCommunicationChannel value = new ChatCommunicationChannel(ignoreDAO.getIgnoredUsers(playerId));
|
||||
_listeners.put(playerId, value);
|
||||
_chatRoom.joinChatRoom(playerId, value);
|
||||
return value.consumeMessages();
|
||||
@@ -84,7 +87,16 @@ public class ChatRoomMediator {
|
||||
throw new PrivateInformationException();
|
||||
|
||||
_logger.trace(playerId+": "+message);
|
||||
_chatRoom.postMessage(playerId, message);
|
||||
_chatRoom.postMessage(playerId, message, true, admin);
|
||||
} finally {
|
||||
_lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendToUser(String from, String to, String message) {
|
||||
_lock.writeLock().lock();
|
||||
try {
|
||||
_chatRoom.postToUser(from, to, message);
|
||||
} finally {
|
||||
_lock.writeLock().unlock();
|
||||
}
|
||||
|
||||
@@ -2,16 +2,22 @@ package com.gempukku.lotro.chat;
|
||||
|
||||
import com.gempukku.lotro.AbstractServer;
|
||||
import com.gempukku.lotro.PrivateInformationException;
|
||||
import com.gempukku.lotro.db.IgnoreDAO;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ChatServer extends AbstractServer {
|
||||
private IgnoreDAO ignoreDAO;
|
||||
private Map<String, ChatRoomMediator> _chatRooms = new ConcurrentHashMap<String, ChatRoomMediator>();
|
||||
|
||||
public ChatServer(IgnoreDAO ignoreDAO) {
|
||||
this.ignoreDAO = ignoreDAO;
|
||||
}
|
||||
|
||||
public ChatRoomMediator createChatRoom(String name, boolean muteJoinPartMessages, int secondsTimeoutPeriod) {
|
||||
ChatRoomMediator chatRoom = new ChatRoomMediator(name, muteJoinPartMessages, secondsTimeoutPeriod);
|
||||
ChatRoomMediator chatRoom = new ChatRoomMediator(ignoreDAO, name, muteJoinPartMessages, secondsTimeoutPeriod);
|
||||
try {
|
||||
chatRoom.sendMessage("System", "Welcome to room: " + name, true);
|
||||
} catch (PrivateInformationException exp) {
|
||||
@@ -24,7 +30,7 @@ public class ChatServer extends AbstractServer {
|
||||
}
|
||||
|
||||
public ChatRoomMediator createPrivateChatRoom(String name, boolean muteJoinPartMessages, Set<String> allowedUsers, int secondsTimeoutPeriod) {
|
||||
ChatRoomMediator chatRoom = new ChatRoomMediator(name, muteJoinPartMessages, secondsTimeoutPeriod, allowedUsers);
|
||||
ChatRoomMediator chatRoom = new ChatRoomMediator(ignoreDAO, name, muteJoinPartMessages, secondsTimeoutPeriod, allowedUsers);
|
||||
try {
|
||||
chatRoom.sendMessage("System", "Welcome to private room: " + name, true);
|
||||
} catch (PrivateInformationException exp) {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.gempukku.lotro.db;
|
||||
|
||||
import com.gempukku.lotro.cache.Cached;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class CachedIgnoreDAO implements IgnoreDAO, Cached {
|
||||
private Map<String, Set<String>> ignores = new ConcurrentHashMap<>();
|
||||
private IgnoreDAO delegate;
|
||||
|
||||
public CachedIgnoreDAO(IgnoreDAO delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCache() {
|
||||
ignores.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return ignores.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getIgnoredUsers(String playerId) {
|
||||
Set<String> ignoredUsers = ignores.get(playerId);
|
||||
if (ignoredUsers == null) {
|
||||
ignoredUsers = Collections.synchronizedSet(delegate.getIgnoredUsers(playerId));
|
||||
ignores.put(playerId, ignoredUsers);
|
||||
}
|
||||
return ignoredUsers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addIgnoredUser(String playerId, String ignoredName) {
|
||||
final Set<String> ignoredUsers = getIgnoredUsers(playerId);
|
||||
if (!ignoredUsers.contains(ignoredName)) {
|
||||
delegate.addIgnoredUser(playerId, ignoredName);
|
||||
ignoredUsers.add(ignoredName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeIgnoredUser(String playerId, String ignoredName) {
|
||||
final Set<String> ignoredUsers = getIgnoredUsers(playerId);
|
||||
if (ignoredUsers.contains(ignoredName)) {
|
||||
delegate.removeIgnoredUser(playerId, ignoredName);
|
||||
ignoredUsers.remove(ignoredName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.gempukku.lotro.db;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class DbIgnoreDAO implements IgnoreDAO {
|
||||
private DbAccess dbAccess;
|
||||
|
||||
public DbIgnoreDAO(DbAccess dbAccess) {
|
||||
this.dbAccess = dbAccess;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getIgnoredUsers(String playerId) {
|
||||
try {
|
||||
try (Connection connection = dbAccess.getDataSource().getConnection()) {
|
||||
try (PreparedStatement statement = connection.prepareStatement("select ignoredName from ignores where playerName=?")) {
|
||||
statement.setString(1, playerId);
|
||||
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
Set<String> ignoredUsers = new TreeSet<>();
|
||||
while (resultSet.next()) {
|
||||
ignoredUsers.add(resultSet.getString(1));
|
||||
}
|
||||
return ignoredUsers;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException exp) {
|
||||
throw new RuntimeException("Unable to get ignored users", exp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addIgnoredUser(String playerId, String ignoredName) {
|
||||
try {
|
||||
try (Connection connection = dbAccess.getDataSource().getConnection()) {
|
||||
try (PreparedStatement statement = connection.prepareStatement("insert into ignores (playerName, ignoredName) values (?, ?)")) {
|
||||
statement.setString(1, playerId);
|
||||
statement.setString(2, ignoredName);
|
||||
|
||||
statement.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (SQLException exp) {
|
||||
throw new RuntimeException("Unable to add ignored user", exp);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeIgnoredUser(String playerId, String ignoredName) {
|
||||
try {
|
||||
try (Connection connection = dbAccess.getDataSource().getConnection()) {
|
||||
try (PreparedStatement statement = connection.prepareStatement("delete from ignores where playerName=? and ignoredName=?")) {
|
||||
statement.setString(1, playerId);
|
||||
statement.setString(2, ignoredName);
|
||||
|
||||
statement.execute();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (SQLException exp) {
|
||||
throw new RuntimeException("Unable to remove ignored user", exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.gempukku.lotro.db;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface IgnoreDAO {
|
||||
Set<String> getIgnoredUsers(String playerId);
|
||||
|
||||
boolean addIgnoredUser(String playerId, String ignoredName);
|
||||
|
||||
boolean removeIgnoredUser(String playerId, String ignoredName);
|
||||
}
|
||||
@@ -7,11 +7,17 @@ import com.gempukku.polling.WaitingRequest;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ChatCommunicationChannel implements ChatRoomListener, LongPollableResource {
|
||||
private List<ChatMessage> _messages = new LinkedList<ChatMessage>();
|
||||
private long _lastConsumed = System.currentTimeMillis();
|
||||
private volatile WaitingRequest _waitingRequest;
|
||||
private Set<String> ignoredUsers;
|
||||
|
||||
public ChatCommunicationChannel(Set<String> ignoredUsers) {
|
||||
this.ignoredUsers = ignoredUsers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void deregisterRequest(WaitingRequest waitingRequest) {
|
||||
@@ -29,10 +35,12 @@ public class ChatCommunicationChannel implements ChatRoomListener, LongPollableR
|
||||
|
||||
@Override
|
||||
public synchronized void messageReceived(ChatMessage message) {
|
||||
_messages.add(message);
|
||||
if (_waitingRequest != null) {
|
||||
_waitingRequest.processRequest();
|
||||
_waitingRequest = null;
|
||||
if (message.isFromAdmin() || !ignoredUsers.contains(message.getFrom())) {
|
||||
_messages.add(message);
|
||||
if (_waitingRequest != null) {
|
||||
_waitingRequest.processRequest();
|
||||
_waitingRequest = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.gempukku.lotro.chat.ChatCommandErrorException;
|
||||
import com.gempukku.lotro.chat.ChatRoomMediator;
|
||||
import com.gempukku.lotro.chat.ChatServer;
|
||||
import com.gempukku.lotro.collection.CollectionsManager;
|
||||
import com.gempukku.lotro.db.IgnoreDAO;
|
||||
import com.gempukku.lotro.db.vo.CollectionType;
|
||||
import com.gempukku.lotro.db.vo.League;
|
||||
import com.gempukku.lotro.draft.Draft;
|
||||
@@ -34,6 +35,7 @@ public class HallServer extends AbstractServer {
|
||||
// Repeat tournaments every 2 days
|
||||
private final long _repeatTournaments = 1000 * 60 * 60 * 24 * 2;
|
||||
|
||||
private IgnoreDAO ignoreDAO;
|
||||
private ChatServer _chatServer;
|
||||
private LeagueService _leagueService;
|
||||
private TournamentService _tournamentService;
|
||||
@@ -72,11 +74,12 @@ public class HallServer extends AbstractServer {
|
||||
// 5 minutes timeout, 40 minutes per game per player
|
||||
private GameTimer competitiveTimer = new GameTimer(false, "Competitive", 60 * 40, 60 * 5);
|
||||
|
||||
public HallServer(LotroServer lotroServer, ChatServer chatServer, LeagueService leagueService, TournamentService tournamentService, LotroCardBlueprintLibrary library,
|
||||
public HallServer(IgnoreDAO ignoreDAO, LotroServer lotroServer, ChatServer chatServer, LeagueService leagueService, TournamentService tournamentService, LotroCardBlueprintLibrary library,
|
||||
LotroFormatLibrary formatLibrary, CollectionsManager collectionsManager,
|
||||
AdminService adminService,
|
||||
TournamentPrizeSchemeRegistry tournamentPrizeSchemeRegistry,
|
||||
PairingMechanismRegistry pairingMechanismRegistry, CardSets cardSets) {
|
||||
this.ignoreDAO = ignoreDAO;
|
||||
_lotroServer = lotroServer;
|
||||
_chatServer = chatServer;
|
||||
_leagueService = leagueService;
|
||||
@@ -123,6 +126,36 @@ public class HallServer extends AbstractServer {
|
||||
}
|
||||
}
|
||||
});
|
||||
_hallChat.addChatCommandCallback("ignore",
|
||||
new ChatCommandCallback() {
|
||||
@Override
|
||||
public void commandReceived(String from, String parameters, boolean admin) throws ChatCommandErrorException {
|
||||
final String playerName = parameters.trim();
|
||||
if (playerName.length() <= 10) {
|
||||
if (ignoreDAO.addIgnoredUser(from, playerName))
|
||||
_hallChat.sendToUser("System", from, "User " + playerName + " added to ignore list");
|
||||
}
|
||||
}
|
||||
});
|
||||
_hallChat.addChatCommandCallback("unignore",
|
||||
new ChatCommandCallback() {
|
||||
@Override
|
||||
public void commandReceived(String from, String parameters, boolean admin) throws ChatCommandErrorException {
|
||||
final String playerName = parameters.trim();
|
||||
if (playerName.length() <= 10) {
|
||||
if (ignoreDAO.removeIgnoredUser(from, playerName))
|
||||
_hallChat.sendToUser("System", from, "User " + playerName + " removed from ignore list");
|
||||
}
|
||||
}
|
||||
});
|
||||
_hallChat.addChatCommandCallback("listIgnores",
|
||||
new ChatCommandCallback() {
|
||||
@Override
|
||||
public void commandReceived(String from, String parameters, boolean admin) throws ChatCommandErrorException {
|
||||
final Set<String> ignoredUsers = ignoreDAO.getIgnoredUsers(from);
|
||||
_hallChat.sendToUser("System", from, Arrays.toString(ignoredUsers.toArray(new String[0])));
|
||||
}
|
||||
});
|
||||
|
||||
_tournamentQueues.put("fotr_queue", new ImmediateRecurringQueue(1000, "fotr_block",
|
||||
CollectionType.ALL_CARDS, "fotrQueue-", "Fellowship SitesBlock", 8,
|
||||
@@ -517,7 +550,29 @@ public class HallServer extends AbstractServer {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isNoIgnores(Collection<String> players, String playerLooking) {
|
||||
// Do not ignore self
|
||||
if (players.contains(playerLooking))
|
||||
return true;
|
||||
|
||||
// This player ignores someone in the players
|
||||
final Set<String> ignoredUsers = ignoreDAO.getIgnoredUsers(playerLooking);
|
||||
if (!Collections.disjoint(ignoredUsers, players))
|
||||
return false;
|
||||
|
||||
// One of the players ignores this player
|
||||
for (String player : players) {
|
||||
final Set<String> ignored = ignoreDAO.getIgnoredUsers(player);
|
||||
if (ignored.contains(playerLooking))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void processHall(Player player, HallInfoVisitor visitor) {
|
||||
final boolean isAdmin = player.getType().contains("a");
|
||||
|
||||
_hallDataAccessLock.readLock().lock();
|
||||
try {
|
||||
visitor.serverTime(DateUtils.getStringDateWithHour());
|
||||
@@ -533,23 +588,24 @@ public class HallServer extends AbstractServer {
|
||||
players = Collections.<String>emptyList();
|
||||
else
|
||||
players = table.getPlayerNames();
|
||||
visitor.visitTable(tableInformation.getKey(), null, false, HallInfoVisitor.TableStatus.WAITING, "Waiting", table.getGameSettings().getLotroFormat().getName(), getTournamentName(table), players, table.getPlayerNames().contains(player.getName()), null);
|
||||
|
||||
if (isAdmin || isNoIgnores(players, player.getName()))
|
||||
visitor.visitTable(tableInformation.getKey(), null, false, HallInfoVisitor.TableStatus.WAITING, "Waiting", table.getGameSettings().getLotroFormat().getName(), getTournamentName(table), players, table.getPlayerNames().contains(player.getName()), null);
|
||||
}
|
||||
|
||||
// Then non-finished
|
||||
Map<String, RunningTable> finishedTables = new HashMap<String, RunningTable>();
|
||||
|
||||
final boolean isAdmin = player.getType().contains("a");
|
||||
|
||||
for (Map.Entry<String, RunningTable> runningGame : _runningTables.entrySet()) {
|
||||
final RunningTable runningTable = runningGame.getValue();
|
||||
LotroGameMediator lotroGameMediator = runningTable.getLotroGameMediator();
|
||||
if (lotroGameMediator != null) {
|
||||
if (isAdmin || lotroGameMediator.isVisibleToUser(player.getName())) {
|
||||
if (!lotroGameMediator.isFinished()) {
|
||||
visitor.visitTable(runningGame.getKey(), lotroGameMediator.getGameId(), isAdmin || lotroGameMediator.isAllowSpectators(), HallInfoVisitor.TableStatus.PLAYING, lotroGameMediator.getGameStatus(), runningTable.getFormatName(), runningTable.getTournamentName(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), lotroGameMediator.getWinner());
|
||||
} else
|
||||
if (isAdmin || (lotroGameMediator.isVisibleToUser(player.getName()) &&
|
||||
isNoIgnores(lotroGameMediator.getPlayersPlaying(), player.getName()))) {
|
||||
if (lotroGameMediator.isFinished())
|
||||
finishedTables.put(runningGame.getKey(), runningTable);
|
||||
else
|
||||
visitor.visitTable(runningGame.getKey(), lotroGameMediator.getGameId(), isAdmin || lotroGameMediator.isAllowSpectators(), HallInfoVisitor.TableStatus.PLAYING, lotroGameMediator.getGameStatus(), runningTable.getFormatName(), runningTable.getTournamentName(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), lotroGameMediator.getWinner());
|
||||
|
||||
if (!lotroGameMediator.isFinished() && lotroGameMediator.getPlayersPlaying().contains(player.getName()))
|
||||
visitor.runningPlayerGame(lotroGameMediator.getGameId());
|
||||
@@ -561,8 +617,10 @@ public class HallServer extends AbstractServer {
|
||||
for (Map.Entry<String, RunningTable> nonPlayingGame : finishedTables.entrySet()) {
|
||||
final RunningTable runningTable = nonPlayingGame.getValue();
|
||||
LotroGameMediator lotroGameMediator = runningTable.getLotroGameMediator();
|
||||
if (lotroGameMediator != null)
|
||||
visitor.visitTable(nonPlayingGame.getKey(), lotroGameMediator.getGameId(), false, HallInfoVisitor.TableStatus.FINISHED, lotroGameMediator.getGameStatus(), runningTable.getFormatName(), runningTable.getTournamentName(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), lotroGameMediator.getWinner());
|
||||
if (lotroGameMediator != null) {
|
||||
if (isAdmin || isNoIgnores(lotroGameMediator.getPlayersPlaying(), player.getName()))
|
||||
visitor.visitTable(nonPlayingGame.getKey(), lotroGameMediator.getGameId(), false, HallInfoVisitor.TableStatus.FINISHED, lotroGameMediator.getGameStatus(), runningTable.getFormatName(), runningTable.getTournamentName(), lotroGameMediator.getPlayersPlaying(), lotroGameMediator.getPlayersPlaying().contains(player.getName()), lotroGameMediator.getWinner());
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, TournamentQueue> tournamentQueueEntry : _tournamentQueues.entrySet()) {
|
||||
|
||||
Reference in New Issue
Block a user