Custom specific Olympiad competition days.
This commit is contained in:
@@ -173,12 +173,12 @@ AltOlyMaxWeeklyMatchesTeam = 10
|
||||
# Enable/disable custom period settings.
|
||||
# Default: False
|
||||
AltOlyUseCustomPeriodSettings = False
|
||||
|
||||
|
||||
# Change the type of delay between two Olympiads.
|
||||
# Available values: MONTH, WEEK, DAY
|
||||
# Default: MONTH
|
||||
AltOlyPeriodType = MONTH
|
||||
|
||||
|
||||
# Change the Olympiad frequency.
|
||||
# The value is a multiplier of period type,
|
||||
# i.e. if type is MONTH and multiplier is 2,
|
||||
@@ -186,3 +186,7 @@ AltOlyPeriodType = MONTH
|
||||
# Default: 1
|
||||
# Note! If type = DAY, multiplier must be >= 7!
|
||||
AltOlyPeriodMultiplier = 1
|
||||
|
||||
# Enable competitions only on specific days.
|
||||
# Default: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||
AltOlyCompetitionDays = 1,2,3,4,5,6,7
|
||||
|
@@ -546,6 +546,7 @@ public final class Config
|
||||
public static boolean ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS;
|
||||
public static String ALT_OLY_PERIOD;
|
||||
public static int ALT_OLY_PERIOD_MULTIPLIER;
|
||||
public static List<Integer> ALT_OLY_COMPETITION_DAYS;
|
||||
public static int ALT_MANOR_REFRESH_TIME;
|
||||
public static int ALT_MANOR_REFRESH_MIN;
|
||||
public static int ALT_MANOR_APPROVE_TIME;
|
||||
@@ -2305,6 +2306,11 @@ public final class Config
|
||||
ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS = Olympiad.getBoolean("AltOlyUseCustomPeriodSettings", false);
|
||||
ALT_OLY_PERIOD = Olympiad.getString("AltOlyPeriod", "MONTH");
|
||||
ALT_OLY_PERIOD_MULTIPLIER = Olympiad.getInt("AltOlyPeriodMultiplier", 1);
|
||||
ALT_OLY_COMPETITION_DAYS = new ArrayList<>();
|
||||
for (String s : Olympiad.getString("AltOlyCompetitionDays", "1,2,3,4,5,6,7").split(","))
|
||||
{
|
||||
ALT_OLY_COMPETITION_DAYS.add(Integer.parseInt(s));
|
||||
}
|
||||
|
||||
final File hexIdFile = new File(HEXID_FILE);
|
||||
if (hexIdFile.exists())
|
||||
|
@@ -354,6 +354,36 @@ public class Olympiad extends ListenersContainer
|
||||
}
|
||||
|
||||
_compStart = Calendar.getInstance();
|
||||
if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS)
|
||||
{
|
||||
final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK);
|
||||
boolean dayFound = false;
|
||||
int dayCounter = 0;
|
||||
for (int i = currentDay; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
dayFound = true;
|
||||
break;
|
||||
}
|
||||
dayCounter++;
|
||||
}
|
||||
if (!dayFound)
|
||||
{
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
dayCounter++;
|
||||
}
|
||||
}
|
||||
if (dayCounter > 0)
|
||||
{
|
||||
_compStart.add(Calendar.DAY_OF_MONTH, dayCounter);
|
||||
}
|
||||
}
|
||||
_compStart.set(Calendar.HOUR_OF_DAY, COMP_START);
|
||||
_compStart.set(Calendar.MINUTE, COMP_MIN);
|
||||
_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;
|
||||
@@ -646,6 +676,36 @@ public class Olympiad extends ListenersContainer
|
||||
private long setNewCompBegin()
|
||||
{
|
||||
_compStart = Calendar.getInstance();
|
||||
if (Config.ALT_OLY_USE_CUSTOM_PERIOD_SETTINGS)
|
||||
{
|
||||
final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK);
|
||||
boolean dayFound = false;
|
||||
int dayCounter = 0;
|
||||
for (int i = currentDay; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
dayFound = true;
|
||||
break;
|
||||
}
|
||||
dayCounter++;
|
||||
}
|
||||
if (!dayFound)
|
||||
{
|
||||
for (int i = 1; i < 8; i++)
|
||||
{
|
||||
if (Config.ALT_OLY_COMPETITION_DAYS.contains(i))
|
||||
{
|
||||
break;
|
||||
}
|
||||
dayCounter++;
|
||||
}
|
||||
}
|
||||
if (dayCounter > 0)
|
||||
{
|
||||
_compStart.add(Calendar.DAY_OF_MONTH, dayCounter);
|
||||
}
|
||||
}
|
||||
_compStart.set(Calendar.HOUR_OF_DAY, COMP_START);
|
||||
_compStart.set(Calendar.MINUTE, COMP_MIN);
|
||||
_compStart.add(Calendar.HOUR_OF_DAY, 24);
|
||||
|
Reference in New Issue
Block a user