From 17a07a46a27922ea1e52abb24caa9f3c188f3961 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Tue, 3 Jul 2012 13:21:29 +0000 Subject: [PATCH] On-demand tournament name. --- .../src/main/java/com/gempukku/lotro/DateUtils.java | 6 ++++++ .../src/main/java/com/gempukku/lotro/hall/HallServer.java | 2 +- .../lotro/tournament/SingleEliminationRecurringQueue.java | 8 +++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/DateUtils.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/DateUtils.java index 132e2d151..bf2992c1b 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/DateUtils.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/DateUtils.java @@ -18,6 +18,12 @@ public class DateUtils { return date.get(Calendar.YEAR) * 100000000 + (date.get(Calendar.MONTH) + 1) * 1000000 + date.get(Calendar.DAY_OF_MONTH) * 10000 + date.get(Calendar.HOUR_OF_DAY) * 100 + date.get(Calendar.MINUTE); } + public static String getStringDateWithHour() { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + format.setTimeZone(TimeZone.getTimeZone("GMT")); + return format.format(new Date()); + } + public static int offsetDate(int start, int dayOffset) { try { SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java index 69a27345e..b03491bef 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java @@ -63,7 +63,7 @@ public class HallServer extends AbstractServer { _runningTournaments.addAll(tournamentService.getLiveTournaments()); _tournamentQueues.put("fotr_queue", new SingleEliminationRecurringQueue(0, _formatLibrary.getFormat("fotr_block"), - new CollectionType("default", "All cards"), "fotrQueue-", 1, "Fellowship Block On-Demand", 4, + new CollectionType("default", "All cards"), "fotrQueue-", "Fellowship Block", 4, tournamentService)); } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java index 8664fff86..bbb125390 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/tournament/SingleEliminationRecurringQueue.java @@ -1,5 +1,6 @@ package com.gempukku.lotro.tournament; +import com.gempukku.lotro.DateUtils; import com.gempukku.lotro.collection.CollectionsManager; import com.gempukku.lotro.db.vo.CollectionType; import com.gempukku.lotro.game.LotroFormat; @@ -23,16 +24,14 @@ public class SingleEliminationRecurringQueue implements TournamentQueue { private TournamentService _tournamentService; private String _tournamentIdPrefix; - private int _tournamentIteration; - public SingleEliminationRecurringQueue(int cost, LotroFormat lotroFormat, CollectionType collectionType, String tournamentIdPrefix, int tournamentIteration, String tournamentQueueName, int playerCap, TournamentService tournamentService) { + public SingleEliminationRecurringQueue(int cost, LotroFormat lotroFormat, CollectionType collectionType, String tournamentIdPrefix, String tournamentQueueName, int playerCap, TournamentService tournamentService) { _cost = cost; _lotroFormat = lotroFormat; _collectionType = collectionType; _tournamentQueueName = tournamentQueueName; _playerCap = playerCap; _tournamentIdPrefix = tournamentIdPrefix; - _tournamentIteration = tournamentIteration; _tournamentService = tournamentService; } @@ -56,8 +55,7 @@ public class SingleEliminationRecurringQueue implements TournamentQueue { if (_playerDecks.size() == _playerCap) { String tournamentId = _tournamentIdPrefix + System.currentTimeMillis(); - String tournamentName = _tournamentQueueName + " - " + _tournamentIteration; - _tournamentIteration++; + String tournamentName = _tournamentQueueName + " - " + DateUtils.getStringDateWithHour(); String parameters = _lotroFormat.getName() + "," + _collectionType.getCode() + "," + _collectionType.getFullName() + "," + tournamentName;