Added - nicer names for tournament games instead of 'casual - tournament'
This commit is contained in:
@@ -78,7 +78,7 @@ public class HallServer extends AbstractServer {
|
||||
_collectionsManager = collectionsManager;
|
||||
_adminService = adminService;
|
||||
|
||||
tableHolder = new TableHolder(leagueService, ignoreDAO);
|
||||
tableHolder = new TableHolder(leagueService, tournamentService, ignoreDAO);
|
||||
|
||||
_hallChat = _chatServer.createChatRoom("Game Hall", true, 300, true,
|
||||
"You're now in the Game Hall, use /help to get a list of available commands.<br>Don't forget to check out the new Discord chat integration! Click the 'Switch to Discord' button in the lower right ---->",
|
||||
|
||||
@@ -8,11 +8,14 @@ import com.gempukku.lotro.game.Player;
|
||||
import com.gempukku.lotro.league.LeagueSerieInfo;
|
||||
import com.gempukku.lotro.league.LeagueService;
|
||||
import com.gempukku.lotro.logic.vo.LotroDeck;
|
||||
import com.gempukku.lotro.tournament.Tournament;
|
||||
import com.gempukku.lotro.tournament.TournamentService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class TableHolder {
|
||||
private final LeagueService leagueService;
|
||||
private final TournamentService tournamentService;
|
||||
private final IgnoreDAO ignoreDAO;
|
||||
|
||||
private final Map<String, GameTable> awaitingTables = new LinkedHashMap<>();
|
||||
@@ -20,8 +23,9 @@ public class TableHolder {
|
||||
|
||||
private int _nextTableId = 1;
|
||||
|
||||
public TableHolder(LeagueService leagueService, IgnoreDAO ignoreDAO) {
|
||||
public TableHolder(LeagueService leagueService, TournamentService tournamentService, IgnoreDAO ignoreDAO) {
|
||||
this.leagueService = leagueService;
|
||||
this.tournamentService = tournamentService;
|
||||
this.ignoreDAO = ignoreDAO;
|
||||
}
|
||||
|
||||
@@ -247,10 +251,18 @@ public class TableHolder {
|
||||
|
||||
private String getTournamentName(GameTable table) {
|
||||
final League league = table.getGameSettings().league();
|
||||
if (league != null)
|
||||
final Tournament tournament = tournamentService.getTournamentById(table.getGameSettings().tournamentId());
|
||||
if (league != null) {
|
||||
return league.getName() + " - " + table.getGameSettings().leagueSerie().getName();
|
||||
else
|
||||
} else if (tournament != null) {
|
||||
String tournamentTableDescription = tournament.getTableDescription();
|
||||
if (tournamentTableDescription == null || tournamentTableDescription.isEmpty()) {
|
||||
return "Casual - " + table.getGameSettings().timeSettings().name();
|
||||
}
|
||||
return tournamentTableDescription;
|
||||
} else {
|
||||
return "Casual - " + table.getGameSettings().timeSettings().name();
|
||||
}
|
||||
}
|
||||
|
||||
public List<GameTable> getTournamentTables(String tournamentId) {
|
||||
|
||||
@@ -531,4 +531,9 @@ public abstract class BaseTournament implements Tournament {
|
||||
public long getSecondsRemaining() throws IllegalStateException{
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableDescription() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,4 +267,13 @@ public class SealedTournament extends BaseTournament implements Tournament {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableDescription() {
|
||||
if (_sealedInfo._params.prizes == PrizeType.NONE && _sealedInfo._params.cost == 0) {
|
||||
return "Casual - " + _sealedInfo.SealedDefinition.GetName();
|
||||
} else {
|
||||
return "Competitive - " + _sealedInfo.SealedDefinition.GetName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,4 +282,13 @@ public class SoloDraftTournament extends BaseTournament implements Tournament {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableDescription() {
|
||||
if (_soloDraftInfo._params.prizes == PrizeType.NONE && _soloDraftInfo._params.cost == 0) {
|
||||
return "Casual - " + _soloDraftLibrary.getSoloDraft(_soloDraftInfo._soloDraftParams.soloDraftFormatCode).getCode();
|
||||
} else {
|
||||
return "Competitive - " + _soloDraftLibrary.getSoloDraft(_soloDraftInfo._soloDraftParams.soloDraftFormatCode).getCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,4 +265,13 @@ public class SoloTableDraftTournament extends BaseTournament implements Tourname
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableDescription() {
|
||||
if (soloTableDraftInfo._params.prizes == PrizeType.NONE && soloTableDraftInfo._params.cost == 0) {
|
||||
return "Casual - " + _tableDraftLibrary.getTableDraftDefinition(soloTableDraftInfo.soloTableDraftParams.soloTableDraftFormatCode).getName();
|
||||
} else {
|
||||
return "Competitive - " + _tableDraftLibrary.getTableDraftDefinition(soloTableDraftInfo.soloTableDraftParams.soloTableDraftFormatCode).getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,4 +278,13 @@ public class TableDraftTournament extends BaseTournament implements Tournament {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTableDescription() {
|
||||
if (tableDraftInfo._params.prizes == PrizeType.NONE && tableDraftInfo._params.cost == 0) {
|
||||
return "Casual - " + _tableDraftLibrary.getTableDraftDefinition(tableDraftInfo.tableDraftParams.tableDraftFormatCode).getName();
|
||||
} else {
|
||||
return "Competitive - " + _tableDraftLibrary.getTableDraftDefinition(tableDraftInfo.tableDraftParams.tableDraftFormatCode).getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,4 +207,5 @@ public interface Tournament {
|
||||
|
||||
boolean isJoinable();
|
||||
long getSecondsRemaining() throws IllegalStateException;
|
||||
String getTableDescription();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user