Server restart schedule by day.
This commit is contained in:
parent
411782efce
commit
6a1f4c21ac
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -762,6 +762,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1288,7 +1289,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1411,6 +1412,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -769,6 +769,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1295,7 +1296,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1418,6 +1419,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -770,6 +770,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1308,7 +1309,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1431,6 +1432,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -757,6 +757,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1295,7 +1296,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1418,6 +1419,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -752,6 +752,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1290,7 +1291,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1413,6 +1414,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -752,6 +752,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1290,7 +1291,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1413,6 +1414,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -753,6 +753,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1312,7 +1313,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1435,6 +1436,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -752,6 +752,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Hardin (Agent of Chaos)
|
// Hardin (Agent of Chaos)
|
||||||
@ -1313,7 +1314,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1436,6 +1437,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -204,3 +204,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -888,6 +888,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// MMO Settings
|
// MMO Settings
|
||||||
@ -1348,7 +1349,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in config file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (config file) for configuring your server.
|
* If the key doesn't appear in config file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (config file) for configuring your server.
|
||||||
@ -1468,6 +1469,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -204,3 +204,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -893,6 +893,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// MMO Settings
|
// MMO Settings
|
||||||
@ -1349,7 +1350,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in config file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (config file) for configuring your server.
|
* If the key doesn't appear in config file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (config file) for configuring your server.
|
||||||
@ -1469,6 +1470,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -760,6 +760,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Vitality Settings
|
// Vitality Settings
|
||||||
@ -1228,7 +1229,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1351,6 +1352,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -760,6 +760,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Vitality Settings
|
// Vitality Settings
|
||||||
@ -1232,7 +1233,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1355,6 +1356,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -760,6 +760,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Vitality Settings
|
// Vitality Settings
|
||||||
@ -1232,7 +1233,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1355,6 +1356,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -760,6 +760,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Vitality Settings
|
// Vitality Settings
|
||||||
@ -1232,7 +1233,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1355,6 +1356,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -760,6 +760,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Vitality Settings
|
// Vitality Settings
|
||||||
@ -1237,7 +1238,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1360,6 +1361,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -759,6 +759,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Vitality Settings
|
// Vitality Settings
|
||||||
@ -1236,7 +1237,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1359,6 +1360,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
@ -220,3 +220,8 @@ ServerRestartScheduleCountdown = 600
|
|||||||
# You can put more than one value separated by commas (,).
|
# You can put more than one value separated by commas (,).
|
||||||
# Example: 12:00, 00:00
|
# Example: 12:00, 00:00
|
||||||
ServerRestartSchedule = 08:00
|
ServerRestartSchedule = 08:00
|
||||||
|
|
||||||
|
# Specify days that the restart will occur. Values separated by commas (,).
|
||||||
|
# Example: 1,2,3,4,5,6,7 (SUNDAY,MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY,SATURDAY)
|
||||||
|
# Default: 4 (WEDNESDAY)
|
||||||
|
ServerRestartDays = 4
|
||||||
|
@ -762,6 +762,7 @@ public class Config
|
|||||||
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
public static boolean SERVER_RESTART_SCHEDULE_MESSAGE;
|
||||||
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
public static int SERVER_RESTART_SCHEDULE_COUNTDOWN;
|
||||||
public static String[] SERVER_RESTART_SCHEDULE;
|
public static String[] SERVER_RESTART_SCHEDULE;
|
||||||
|
public static List<Integer> SERVER_RESTART_DAYS;
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Vitality Settings
|
// Vitality Settings
|
||||||
@ -1239,7 +1240,7 @@ public class Config
|
|||||||
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
public static Map<Integer, Integer> L2TOP_REWARD = new HashMap<>();
|
||||||
public static int L2TOP_DUALBOXES_ALLOWED;
|
public static int L2TOP_DUALBOXES_ALLOWED;
|
||||||
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
public static boolean ALLOW_L2TOP_GAME_SERVER_REPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class initializes all global variables for configuration.<br>
|
* This class initializes all global variables for configuration.<br>
|
||||||
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
* If the key doesn't appear in properties file, a default value is set by this class. {@link #SERVER_CONFIG_FILE} (properties file) for configuring your server.
|
||||||
@ -1362,6 +1363,14 @@ public class Config
|
|||||||
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
SERVER_RESTART_SCHEDULE_MESSAGE = serverSettings.getBoolean("ServerRestartScheduleMessage", false);
|
||||||
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
SERVER_RESTART_SCHEDULE_COUNTDOWN = serverSettings.getInt("ServerRestartScheduleCountdown", 600);
|
||||||
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
SERVER_RESTART_SCHEDULE = serverSettings.getString("ServerRestartSchedule", "08:00").split(",");
|
||||||
|
SERVER_RESTART_DAYS = new ArrayList<>();
|
||||||
|
for (String day : serverSettings.getString("ServerRestartDays", "").trim().split(","))
|
||||||
|
{
|
||||||
|
if (Util.isDigit(day))
|
||||||
|
{
|
||||||
|
SERVER_RESTART_DAYS.add(Integer.parseInt(day));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hosts and Subnets
|
// Hosts and Subnets
|
||||||
final IPConfigData ipcd = new IPConfigData();
|
final IPConfigData ipcd = new IPConfigData();
|
||||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.instancemanager;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@ -25,7 +26,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
|||||||
import org.l2jmobius.gameserver.Shutdown;
|
import org.l2jmobius.gameserver.Shutdown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gigi
|
* @author Gigi, Mobius
|
||||||
*/
|
*/
|
||||||
public class ServerRestartManager
|
public class ServerRestartManager
|
||||||
{
|
{
|
||||||
@ -52,7 +53,15 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
if (restartTime.getTimeInMillis() < currentTime.getTimeInMillis())
|
||||||
{
|
{
|
||||||
restartTime.add(Calendar.DAY_OF_MONTH, 1);
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
while (!Config.SERVER_RESTART_DAYS.contains(restartTime.get(Calendar.DAY_OF_WEEK)))
|
||||||
|
{
|
||||||
|
restartTime.add(Calendar.DAY_OF_WEEK, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
delay = restartTime.getTimeInMillis() - currentTime.getTimeInMillis();
|
||||||
@ -70,7 +79,14 @@ public class ServerRestartManager
|
|||||||
|
|
||||||
if (lastRestart != null)
|
if (lastRestart != null)
|
||||||
{
|
{
|
||||||
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
if (Config.SERVER_RESTART_DAYS.isEmpty())
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("HH:mm").format(lastRestart.getTime());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextRestartTime = new SimpleDateFormat("MMMM d'" + getDayNumberSuffix(lastRestart.get(Calendar.DAY_OF_MONTH)) + "' HH:mm", Locale.UK).format(lastRestart.getTime());
|
||||||
|
}
|
||||||
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
ThreadPool.schedule(new ServerRestartTask(), lastDelay - (Config.SERVER_RESTART_SCHEDULE_COUNTDOWN * 1000));
|
||||||
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
LOGGER.info("Scheduled server restart at " + lastRestart.getTime() + ".");
|
||||||
}
|
}
|
||||||
@ -81,6 +97,33 @@ public class ServerRestartManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDayNumberSuffix(int day)
|
||||||
|
{
|
||||||
|
switch (day)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 21:
|
||||||
|
case 31:
|
||||||
|
{
|
||||||
|
return "st";
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
case 22:
|
||||||
|
{
|
||||||
|
return "nd";
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
case 23:
|
||||||
|
{
|
||||||
|
return "rd";
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getNextRestartTime()
|
public String getNextRestartTime()
|
||||||
{
|
{
|
||||||
return nextRestartTime;
|
return nextRestartTime;
|
||||||
|
Loading…
Reference in New Issue
Block a user