###EclipseWorkspacePatch1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 2) +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy) @@-17,6+17,7@@ import net.sf.l2j.Config; import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.GameTimeController; +import net.sf.l2j.gameserver.Restart; import net.sf.l2j.gameserver.communitybbs.Manager.MailBBSManager; import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights; import net.sf.l2j.gameserver.datatables.GmListTable; @@-186,6+187,11@@ } } +if(Config.RESTART_BY_TIME_OF_DAY) +{ +ShowNextRestart(activeChar); +} + activeChar.getMacroses().sendUpdate(); activeChar.sendPacket(newUserInfo(activeChar)); activeChar.sendPacket(newHennaInfo(activeChar)); @@-323,4+329,10@@ { returnfalse; } + +privatestaticvoidShowNextRestart(L2PcInstance activeChar) +{ + activeChar.sendMessage("Next Restart: "+Restart.getInstance().getRestartNextTime()); +} + } \ No newline at end of file Index: java/net/sf/l2j/gameserver/Restart.java =================================================================== --- java/net/sf/l2j/gameserver/Restart.java (revision 0) +++ java/net/sf/l2j/gameserver/Restart.java (working copy) @@-0,0+1,114@@ +/* +* This program is free software: you can redistribute it and/or modify it under +* the terms of the GNU General Public License as published by the Free Software +* Foundation, either version 3 of the License, or (at your option) any later +* version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +* details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <
O conteúdo está oculto, favor efetuar login ou se cadastrar!
+*/ +package net.sf.l2j.gameserver; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.logging.Logger; + +import net.sf.l2j.Config; +import net.sf.l2j.gameserver.ThreadPoolManager; + +/** +* @author Toxico +*/ + +publicclassRestart +{ +//Variaveis globais +privatestaticRestart _instance =null; +protectedstatic final Logger _log =Logger.getLogger(Restart.class.getName()); +privateCalendarNextRestart; +privateSimpleDateFormat format =newSimpleDateFormat("HH:mm"); + +//Singleton +publicstaticRestart getInstance() +{ +if(_instance ==null) + _instance =newRestart(); +return _instance; +} + +publicString getRestartNextTime() +{ +if(NextRestart.getTime()!=null) +return format.format(NextRestart.getTime()); +return"Erro"; +} + +//Connstrutor +privateRestart() +{ +//:D +} + +publicvoidStartCalculationOfNextRestartTime() +{ +try +{ +Calendar currentTime =Calendar.getInstance(); +Calendar testStartTime =null; +long flush2 =0,timeL =0; +int count =0; + +for(String timeOfDay :Config.RESTART_INTERVAL_BY_TIME_OF_DAY) +{ + testStartTime =Calendar.getInstance(); + testStartTime.setLenient(true); +String[] splitTimeOfDay = timeOfDay.split(":"); + testStartTime.set(Calendar.HOUR_OF_DAY,Integer.parseInt(splitTimeOfDay[0])); + testStartTime.set(Calendar.MINUTE,Integer.parseInt(splitTimeOfDay[1])); + testStartTime.set(Calendar.SECOND,00); +//Verifica a validade to tempo +if(testStartTime.getTimeInMillis()< currentTime.getTimeInMillis()) +{ + testStartTime.add(Calendar.DAY_OF_MONTH,1); +} + +//TimeL Recebe o quanto falta de milisegundos para o restart + timeL = testStartTime.getTimeInMillis()- currentTime.getTimeInMillis(); + +//Verifica qual horario sera o proximo restart +if(count ==0){ + flush2 = timeL; +NextRestart= testStartTime; +} + +if(timeL < flush2){ + flush2 = timeL; +NextRestart= testStartTime; +} + + count ++; +} + _log.info("Auto Restart: Next Restart Time: "+NextRestart.getTime().toString()); +ThreadPoolManager.getInstance().scheduleGeneral(newStartRestartTask(), flush2); +} +catch(Exception e) +{ +System.out.println("[AutoRestart]: The restart automated server presented error in load restarts period config !"); +} +} + +classStartRestartTask implements Runnable +{ +@Override +publicvoid run() +{ + _log.info("Start automated restart GameServer."); +Shutdown.getInstance().autoRestart(Config.RESTART_SECONDS); +} +} +} \ No newline at end of file Index: java/net/sf/l2j/gameserver/GameServer.java =================================================================== --- java/net/sf/l2j/gameserver/GameServer.java (revision 2) +++ java/net/sf/l2j/gameserver/GameServer.java (working copy) @@-178,6+178,13@@ GmListTable.getInstance(); RaidBossPointsManager.getInstance(); +Util.printSection("Restart Manager"); +if(Config.RESTART_BY_TIME_OF_DAY) +Restart.getInstance().StartCalculationOfNextRestartTime(); +else + _log.info("# Auto Restart System is Disabled #"); +System.gc(); + Util.printSection("Community server"); if(Config.ENABLE_COMMUNITY_BOARD)// Forums has to be loaded before clan data ForumsBBSManager.getInstance().initRoot(); Index: java/net/sf/l2j/gameserver/Shutdown.java =================================================================== --- java/net/sf/l2j/gameserver/Shutdown.java (revision 2) +++ java/net/sf/l2j/gameserver/Shutdown.java (working copy) @@-71,6+71,18@@ Broadcast.toAllOnlinePlayers(sysm); } +publicvoid autoRestart(int time) +{ + _secondsShut = time; + + countdown(); + + _shutdownMode = GM_RESTART; + +SingletonHolder._instance.setMode(GM_RESTART); +System.exit(2); +} + /** * Default constucter is only used internal to create the shutdown-hook instance */ Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 2) +++ java/net/sf/l2j/Config.java (working copy) @@-652,6+652,11@@ publicstaticint ZONE_TOWN; publicstatic boolean DISABLE_TUTORIAL; +/** Auto Restart */ +publicstatic boolean RESTART_BY_TIME_OF_DAY; +publicstaticint RESTART_SECONDS; +publicstaticString[] RESTART_INTERVAL_BY_TIME_OF_DAY; + // -------------------------------------------------- // Those "hidden" settings haven't configs to avoid admins to fuck their server // You still can experiment changing values here. But don't say I didn't warn you. @@-1261,6+1266,10@@ ZONE_TOWN = server.getProperty("ZoneTown",0); SERVER_NEWS = server.getProperty("ShowServerNews",false); DISABLE_TUTORIAL = server.getProperty("DisableTutorial",false); + + RESTART_BY_TIME_OF_DAY =Boolean.parseBoolean(server.getProperty("EnableRestartSystem","false")); + RESTART_SECONDS =Integer.parseInt(server.getProperty("RestartSeconds","360")); + RESTART_INTERVAL_BY_TIME_OF_DAY = server.getProperty("RestartByTimeOfDay","20:00").split(","); } elseif(Server.serverMode ==Server.MODE_LOGINSERVER) { Index: config/server.properties =================================================================== --- config/server.properties (revision 2) +++ config/server.properties (working copy) @@-370,4+370,20@@ ShowServerNews=False
#Disable tutorial on new player game entrance.Default:False. -DisableTutorial=False \ No newline at end of file +DisableTutorial=False + +#================================================================= +#AutoRestart +#================================================================= + +#Enable/DisableRestartAuto +EnableRestartSystem=True + +#IfEnableRestartSystem=TrueDescribe hours of the day +#Example:22:00,23:00(hh:mm,hh:mm...) +# NOTE:Separate":" mm:hh and "," others restart time +RestartByTimeOfDay=00:00,12:00 + +#Seconds to restart the server (360=5Minutos) +#default=360 +RestartSeconds=360
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
GOSTARIA DOS ICONES DAS TATTOS , TODOS ICONES , COM ESSE LV , ATÉ O LVL 6 POR FAVOR , PARA INTERLUDE , ESSES DO PRINT NAO SAO INTERLUDE E NAO TENHO ! OBRIGADO!
Olá, seu tópico se encontra com um ou mais links offline. Caso ainda possua o conteúdo, favor postar aqui mesmo no tópico ou mandar MP para algum staff que estaremos normalizando o tópico.
Grato pela atenção!
Voce usar a conta de admin q vc tem no server, vai em accounts e define o acess_level la. e vc entra auto.
Eu tenho uma versão desse votesystem q tentei atualizar e com tutorial so acessar o link na minha assinatura em baixo.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Pergunta
claudeny
### Eclipse Workspace Patch 1.0
O conteúdo está oculto, favor efetuar login ou se cadastrar!
-
Entre
- ou
-
Cadastre-se
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 2)
+++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -17,6 +17,7 @@
import net.sf.l2j.Config;
import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.GameTimeController;
+import net.sf.l2j.gameserver.Restart;
import net.sf.l2j.gameserver.communitybbs.Manager.MailBBSManager;
import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights;
import net.sf.l2j.gameserver.datatables.GmListTable;
@@ -186,6 +187,11 @@
}
}
+ if(Config.RESTART_BY_TIME_OF_DAY)
+ {
+ ShowNextRestart(activeChar);
+ }
+
activeChar.getMacroses().sendUpdate();
activeChar.sendPacket(new UserInfo(activeChar));
activeChar.sendPacket(new HennaInfo(activeChar));
@@ -323,4 +329,10 @@
{
return false;
}
+
+ private static void ShowNextRestart(L2PcInstance activeChar)
+ {
+ activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime());
+ }
+
}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/Restart.java
===================================================================
--- java/net/sf/l2j/gameserver/Restart.java (revision 0)
+++ java/net/sf/l2j/gameserver/Restart.java (working copy)
@@ -0,0 +1,114 @@
+/*
+* This program is free software: you can redistribute it and/or modify it under
+* the terms of the GNU General Public License as published by the Free Software
+* Foundation, either version 3 of the License, or (at your option) any later
+* version.
+*
+* This program is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+* details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this program. If not, see <
+*/
+package net.sf.l2j.gameserver;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.logging.Logger;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+
+/**
+* @author Toxico
+*/
+
+public class Restart
+ {
+ //Variaveis globais
+ private static Restart _instance = null;
+ protected static final Logger _log = Logger.getLogger(Restart.class.getName());
+ private Calendar NextRestart;
+ private SimpleDateFormat format = new SimpleDateFormat("HH:mm");
+
+ //Singleton
+ public static Restart getInstance()
+ {
+ if(_instance == null)
+ _instance = new Restart();
+ return _instance;
+ }
+
+ public String getRestartNextTime()
+ {
+ if(NextRestart.getTime() != null)
+ return format.format(NextRestart.getTime());
+ return "Erro";
+ }
+
+ //Connstrutor
+ private Restart()
+ {
+ //:D
+ }
+
+ public void StartCalculationOfNextRestartTime()
+ {
+ try
+ {
+ Calendar currentTime = Calendar.getInstance();
+ Calendar testStartTime = null;
+ long flush2 = 0,timeL = 0;
+ int count = 0;
+
+ for (String timeOfDay : Config.RESTART_INTERVAL_BY_TIME_OF_DAY)
+ {
+ testStartTime = Calendar.getInstance();
+ testStartTime.setLenient(true);
+ String[] splitTimeOfDay = timeOfDay.split(":");
+ testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
+ testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
+ testStartTime.set(Calendar.SECOND, 00);
+ //Verifica a validade to tempo
+ if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
+ {
+ testStartTime.add(Calendar.DAY_OF_MONTH, 1);
+ }
+
+ //TimeL Recebe o quanto falta de milisegundos para o restart
+ timeL = testStartTime.getTimeInMillis() - currentTime.getTimeInMillis();
+
+ //Verifica qual horario sera o proximo restart
+ if(count == 0){
+ flush2 = timeL;
+ NextRestart = testStartTime;
+ }
+
+ if(timeL < flush2){
+ flush2 = timeL;
+ NextRestart = testStartTime;
+ }
+
+ count ++;
+ }
+ _log.info("Auto Restart: Next Restart Time: " + NextRestart.getTime().toString());
+ ThreadPoolManager.getInstance().scheduleGeneral(new StartRestartTask(), flush2);
+ }
+ catch (Exception e)
+ {
+ System.out.println("[AutoRestart]: The restart automated server presented error in load restarts period config !");
+ }
+ }
+
+ class StartRestartTask implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ _log.info("Start automated restart GameServer.");
+ Shutdown.getInstance().autoRestart(Config.RESTART_SECONDS);
+ }
+ }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java (revision 2)
+++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
@@ -178,6 +178,13 @@
GmListTable.getInstance();
RaidBossPointsManager.getInstance();
+ Util.printSection("Restart Manager");
+ if(Config.RESTART_BY_TIME_OF_DAY)
+ Restart.getInstance().StartCalculationOfNextRestartTime();
+ else
+ _log.info("# Auto Restart System is Disabled #");
+ System.gc();
+
Util.printSection("Community server");
if (Config.ENABLE_COMMUNITY_BOARD) // Forums has to be loaded before clan data
ForumsBBSManager.getInstance().initRoot();
Index: java/net/sf/l2j/gameserver/Shutdown.java
===================================================================
--- java/net/sf/l2j/gameserver/Shutdown.java (revision 2)
+++ java/net/sf/l2j/gameserver/Shutdown.java (working copy)
@@ -71,6 +71,18 @@
Broadcast.toAllOnlinePlayers(sysm);
}
+ public void autoRestart(int time)
+ {
+ _secondsShut = time;
+
+ countdown();
+
+ _shutdownMode = GM_RESTART;
+
+ SingletonHolder._instance.setMode(GM_RESTART);
+ System.exit(2);
+ }
+
/**
* Default constucter is only used internal to create the shutdown-hook instance
*/
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 2)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -652,6 +652,11 @@
public static int ZONE_TOWN;
public static boolean DISABLE_TUTORIAL;
+ /** Auto Restart */
+ public static boolean RESTART_BY_TIME_OF_DAY;
+ public static int RESTART_SECONDS;
+ public static String[] RESTART_INTERVAL_BY_TIME_OF_DAY;
+
// --------------------------------------------------
// Those "hidden" settings haven't configs to avoid admins to fuck their server
// You still can experiment changing values here. But don't say I didn't warn you.
@@ -1261,6 +1266,10 @@
ZONE_TOWN = server.getProperty("ZoneTown", 0);
SERVER_NEWS = server.getProperty("ShowServerNews", false);
DISABLE_TUTORIAL = server.getProperty("DisableTutorial", false);
+
+ RESTART_BY_TIME_OF_DAY = Boolean.parseBoolean(server.getProperty("EnableRestartSystem", "false"));
+ RESTART_SECONDS = Integer.parseInt(server.getProperty("RestartSeconds", "360"));
+ RESTART_INTERVAL_BY_TIME_OF_DAY = server.getProperty("RestartByTimeOfDay", "20:00").split(",");
}
else if (Server.serverMode == Server.MODE_LOGINSERVER)
{
Index: config/server.properties
===================================================================
--- config/server.properties (revision 2)
+++ config/server.properties (working copy)
@@ -370,4 +370,20 @@
ShowServerNews = False
# Disable tutorial on new player game entrance. Default: False.
-DisableTutorial = False
\ No newline at end of file
+DisableTutorial = False
+
+# =================================================================
+# Auto Restart
+# =================================================================
+
+# Enable / Disable Restart Auto
+EnableRestartSystem = True
+
+# If EnableRestartSystem = True Describe hours of the day
+# Example: 22:00,23:00 (hh:mm,hh:mm...)
+# NOTE: Separate ":" mm:hh and "," others restart time
+RestartByTimeOfDay = 00:00,12:00
+
+# Seconds to restart the server ( 360 = 5 Minutos )
+# default = 360
+RestartSeconds = 360
Francisco claudeny Silva andrade
Link para o comentário
Compartilhar em outros sites
0 respostass a esta questão
Posts recomendados
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.