From efa09e6ce263eb152bc5f58b09e3ceb7610b1d34 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 14 Oct 2019 13:48:49 +0000 Subject: [PATCH] Fixed Olympiad Sunday only period reseting to Monday. Contributed by Sahar. --- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../model/entity/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- .../gameserver/model/olympiad/Olympiad.java | 21 ++++++++++++++++--- 16 files changed, 288 insertions(+), 48 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index cd26041077..6bf7fd11d5 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -721,9 +721,26 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + 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++) @@ -751,8 +768,6 @@ public class Olympiad extends ListenersContainer _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index cd26041077..6bf7fd11d5 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -721,9 +721,26 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + 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++) @@ -751,8 +768,6 @@ public class Olympiad extends ListenersContainer _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index cd26041077..6bf7fd11d5 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -721,9 +721,26 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + 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++) @@ -751,8 +768,6 @@ public class Olympiad extends ListenersContainer _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 5d7a043d86..9d95aee677 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -695,7 +695,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -722,8 +739,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 5d7a043d86..9d95aee677 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -695,7 +695,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -722,8 +739,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 5d7a043d86..9d95aee677 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -695,7 +695,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -722,8 +739,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 5d7a043d86..9d95aee677 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -695,7 +695,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -722,8 +739,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index adf7c226fa..4cef991a43 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -695,7 +695,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -722,8 +739,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java index 2f6d09391f..d5d6c1cca9 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java @@ -914,9 +914,26 @@ public class Olympiad private long setNewCompBegin() { _compStart = Calendar.getInstance(); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + 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++) @@ -944,8 +961,6 @@ public class Olympiad _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 14a623c590..cc1b1b9218 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -756,9 +756,26 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + 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++) @@ -786,8 +803,6 @@ public class Olympiad extends ListenersContainer _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 96c1d42cb3..efdc2e91c6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -697,7 +697,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -724,8 +741,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 96c1d42cb3..efdc2e91c6 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -697,7 +697,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -724,8 +741,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 96c1d42cb3..efdc2e91c6 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -697,7 +697,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -724,8 +741,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 96c1d42cb3..efdc2e91c6 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -697,7 +697,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -724,8 +741,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 96c1d42cb3..efdc2e91c6 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -697,7 +697,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -724,8 +741,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java index 96c1d42cb3..efdc2e91c6 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/olympiad/Olympiad.java @@ -697,7 +697,24 @@ public class Olympiad extends ListenersContainer private long setNewCompBegin() { _compStart = Calendar.getInstance(); - final int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + + int currentDay = _compStart.get(Calendar.DAY_OF_WEEK); + _compStart.set(Calendar.HOUR_OF_DAY, COMP_START); + _compStart.set(Calendar.MINUTE, COMP_MIN); + + // Today's competitions ended, start checking from next day. + if (currentDay == _compStart.get(Calendar.DAY_OF_WEEK)) + { + if (currentDay == Calendar.SATURDAY) + { + currentDay = Calendar.SUNDAY; + } + else + { + currentDay++; + } + } + boolean dayFound = false; int dayCounter = 0; for (int i = currentDay; i < 8; i++) @@ -724,8 +741,6 @@ public class Olympiad extends ListenersContainer { _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); _compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;