Você não é registrado, por favor registre-se para ter acesso ao conteúdo completo.
Caso seja registrado, efetue login.
Esqueceu sua senha? Clique aqui
Recomendamos o uso do Mozilla Firefox para uma melhor visualização.    


Início Postados Hoje Marcar Fóruns Como Lidos Álbums Banidos SE Team Medalhas
Voltar   Secret Experience > Área L2J > [L2J] Downloads > [Lineage] Java Mods
Registrar Loteria VIPStaff SERegras do fórum Comunidade Arcade Postados Hoje Pesquisar Experience
   

Secret Experience.NET   Secret Experience Corporation - Welcome To The Real World
     Anúncios SE

Resposta
 
LinkBack Ferramentas do Tópico Modos de Exibição
Antigo 20-05-2010, 01:30 PM   #1 (permalink)
Membro - Veterano
 
Avatar de Guma
 
Registrado em: Sep 2009
Localização: Florianopolis (sc)
Posts: 591
Agradeceu: 72
Agradecido 724 Vezes em 241 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
Enviar mensagem via Windows Live Messenger para Guma
Nome Real: i'm Guma

Inventório de Guma

Padrão [Share]Server Restart

nome do server quando for dar restart

Properties:
Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
+#Abort/Restart/Shutdown Setting
+#When the server restarts/aborts shutdown-restart/shutdowns it will say , Server "x" is restarting/shutdowning
+AbortRestart = Server
Config.java
Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
@@ -973,6 +973,8 @@
    public static String    PM_TEXT1;
    public static String    PM_TEXT2;
+   public static String    ABORT_RR; 
    public static boolean   ENABLE_ONLINE_COMMAND;
    public static boolean   ENABLE_STATINFO_COMMAND; 
+
    /** L2J Mods Custom - End */ 
 	         
@@ -1287,4 +1289,5 @@
               PM_TEXT1                 = L2JMods.getProperty("PMText1", "Welcome to our server");
               PM_TEXT2                 = L2JMods.getProperty("PMText2", "Visit our web http://Your.Web.Adress");

+ 	       ABORT_RR                 = L2JMods.getProperty("AbortRestart", "Server");

               ENABLE_ONLINE_COMMAND    = Boolean.parseBoolean(L2JMods.getProperty("EnableOnlinePlayersCommand", "False"));
               ENABLE_STATINFO_COMMAND  = Boolean.parseBoolean(L2JMods.getProperty("EnableStatusInfoCommand", "False"));
@@ -2652,5 +2655,7 @@
         else if (pName.equalsIgnoreCase("TvTEventRunningTime")) TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId")) TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);

+	 else if (pName.equalsIgnoreCase("AbortRestart")) ABORT_RR = (pValue);
       
         // PvP settings
         else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);

Shutdown.java
Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
@@ -83,5 +83,5 @@
         {
             _an.announceToAll("Attention players!");
-            _an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");
+            _an.announceToAll("Server is " + Config.ABORT_RR + " aborts" + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");
             if(_shutdownMode == 1 || _shutdownMode == 2)
             {

Guma está offline  
Links Patrocinados
Antigo 27-09-2010, 05:06 PM   #2 (permalink)
Membro - Soldado
 
Avatar de nery
 
Registrado em: Feb 2009
Posts: 14
Agradeceu: 3
Agradecido 2 Vezes em 2 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Pontos: 3,249, Nível: 35
Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35
Atividade: 0%
Atividade: 0% Atividade: 0% Atividade: 0%

Inventório de nery

Padrão

nao consegui implantar a ultima parte do Shutdown.java pode dar uma luz ai????

essa:

_an.announceToAll("Server is " + Config.ABORT_RR + " aborts" + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");

veja erro do compilador

Citação:
2jserver\gameserver\Shutdown.java:82: cannot find symbol
[javac] symbol : variable _an
[javac] location: class com.l2jserver.gameserver.Shutdown
[javac] _an.announceToAll("Server is " + Config.ABORT_RR + " abo
rts" + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");
[javac] ^
[javac] 1 error

nery está offline   Responder com Citação
Antigo 27-09-2010, 06:41 PM   #3 (permalink)
Membro - Veterano
 
Avatar de Mazokista
 
Registrado em: Dec 2009
Posts: 1,335
Agradeceu: 490
Agradecido 803 Vezes em 427 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Sistema
Rate Designer: Iniciante
Meu Estado:
Enviar mensagem via Windows Live Messenger para Mazokista
Nome Real: Roberto

Inventório de Mazokista

Padrão

No Caso Voce Adiciono Essa Parte ?

Config.java
Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
@@ -973,6 +973,8 @@
    public static String    PM_TEXT1;
    public static String    PM_TEXT2;
+   public static String    ABORT_RR; 
    public static boolean   ENABLE_ONLINE_COMMAND;
    public static boolean   ENABLE_STATINFO_COMMAND; 
+
    /** L2J Mods Custom - End */ 
              
@@ -1287,4 +1289,5 @@
               PM_TEXT1                 = L2JMods.getProperty("PMText1", "Welcome to our server");
               PM_TEXT2                 = L2JMods.getProperty("PMText2", "Visit our web http://Your.Web.Adress");

+            ABORT_RR                 = L2JMods.getProperty("AbortRestart", "Server");

               ENABLE_ONLINE_COMMAND    = Boolean.parseBoolean(L2JMods.getProperty("EnableOnlinePlayersCommand", "False"));
               ENABLE_STATINFO_COMMAND  = Boolean.parseBoolean(L2JMods.getProperty("EnableStatusInfoCommand", "False"));
@@ -2652,5 +2655,7 @@
         else if (pName.equalsIgnoreCase("TvTEventRunningTime")) TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
         else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId")) TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);

+     else if (pName.equalsIgnoreCase("AbortRestart")) ABORT_RR = (pValue);
       
         // PvP settings
         else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);

Mazokista está offline   Responder com Citação
Antigo 27-09-2010, 06:53 PM   #4 (permalink)
Membro - Soldado
 
Avatar de nery
 
Registrado em: Feb 2009
Posts: 14
Agradeceu: 3
Agradecido 2 Vezes em 2 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Pontos: 3,249, Nível: 35
Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35
Atividade: 0%
Atividade: 0% Atividade: 0% Atividade: 0%

Inventório de nery

Padrão

sim toda ela amigo so ta faltando eu finalizar a Shutdown.java

onde quer que eu coloco isso ai

Citação:
_an.announceToAll("Server is " + Config.ABORT_RR + " aborts" + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");
o sclipse nao compila da erro...

nery está offline   Responder com Citação
Antigo 27-09-2010, 06:55 PM   #5 (permalink)
Membro - Veterano
 
Avatar de Mazokista
 
Registrado em: Dec 2009
Posts: 1,335
Agradeceu: 490
Agradecido 803 Vezes em 427 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Sistema
Rate Designer: Iniciante
Meu Estado:
Enviar mensagem via Windows Live Messenger para Mazokista
Nome Real: Roberto

Inventório de Mazokista

Padrão

Procure essa Linha

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
-            _an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");
e Subistitua Por Essa
Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
+            _an.announceToAll("Server is " + Config.ABORT_RR + " aborts" + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");

Mazokista está offline   Responder com Citação
Antigo 27-09-2010, 07:07 PM   #6 (permalink)
Membro - Soldado
 
Avatar de nery
 
Registrado em: Feb 2009
Posts: 14
Agradeceu: 3
Agradecido 2 Vezes em 2 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Pontos: 3,249, Nível: 35
Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35
Atividade: 0%
Atividade: 0% Atividade: 0% Atividade: 0%

Inventório de nery

Padrão

pois é na minha rev nao tem essa linha e é [L2JServer]

nery está offline   Responder com Citação
Antigo 27-09-2010, 07:13 PM   #7 (permalink)
Membro - Veterano
 
Avatar de Mazokista
 
Registrado em: Dec 2009
Posts: 1,335
Agradeceu: 490
Agradecido 803 Vezes em 427 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Sistema
Rate Designer: Iniciante
Meu Estado:
Enviar mensagem via Windows Live Messenger para Mazokista
Nome Real: Roberto

Inventório de Mazokista

Padrão

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package net.sf.l2j.gameserver;

import java.util.logging.Level;
import java.util.logging.Logger;

import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.gameserverpackets.ServerStatus;
import net.sf.l2j.gameserver.instancemanager.CastleManorManager;
import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
import net.sf.l2j.gameserver.instancemanager.ItemsOnGroundManager;
import net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager;
import net.sf.l2j.gameserver.instancemanager.QuestManager;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.L2GameClient;
import net.sf.l2j.gameserver.serverpackets.ServerClose;

/**
 *
 * This class provides the functions for shutting down and restarting the server
 * It closes all open clientconnections and saves all data.
 *
 * @version $Revision: 1.2.4.5 $ $Date: 2005/03/27 15:29:09 $
 */
public class Shutdown extends Thread
{
	private static Logger _log = Logger.getLogger(Shutdown.class.getName());
	private static Shutdown _instance;
	private static Shutdown _counterInstance = null;

	private int _secondsShut;

	private int _shutdownMode;
	public static final int SIGTERM = 0;
	public static final int GM_SHUTDOWN = 1;
	public static final int GM_RESTART = 2;
	public static final int ABORT = 3;
	private static final String[] MODE_TEXT = {"SIGTERM", "shutting down", "restarting", "aborting"};

    /**
     * This function starts a shutdown countdown from Telnet (Copied from Function startShutdown())
     *
     * @param ip            IP Which Issued shutdown command
     * @param seconds       seconds untill shutdown
     * @param restart       true if the server will restart after shutdown
     */

    public void startTelnetShutdown(String IP, int seconds, boolean restart)
    {
        Announcements _an = Announcements.getInstance();
        _log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");
        //_an.announceToAll("Server is " + _modeText[shutdownMode] + " in "+seconds+ " seconds!");

        if (restart) {
            _shutdownMode = GM_RESTART;
        } else {
            _shutdownMode = GM_SHUTDOWN;
        }

        if(_shutdownMode > 0)
        {
            _an.announceToAll("Attention players!");
            _an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in "+seconds+ " seconds!");
            if(_shutdownMode == 1 || _shutdownMode == 2)
            {
                _an.announceToAll("Please, avoid to use Gatekeepers/SoE");
                _an.announceToAll("during server " + MODE_TEXT[_shutdownMode] + " procedure.");
            }
        }

        if (_counterInstance != null) {
            _counterInstance._abort();
        }
        _counterInstance = new Shutdown(seconds, restart);
        _counterInstance.start();
    }

Caso nao Tenha Esse Mod ja Existe em Sua Pack

Mazokista está offline   Responder com Citação
Antigo 28-09-2010, 07:31 AM   #8 (permalink)
Membro - Soldado
 
Avatar de nery
 
Registrado em: Feb 2009
Posts: 14
Agradeceu: 3
Agradecido 2 Vezes em 2 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Pontos: 3,249, Nível: 35
Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35 Pontos: 3,249, Nível: 35
Atividade: 0%
Atividade: 0% Atividade: 0% Atividade: 0%

Inventório de nery

Padrão

nao tem e nen o mode existe veja ai

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
/*
 * 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 <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.gameserver;

import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.datatables.ClanTable;
import com.l2jserver.gameserver.datatables.OfflineTradersTable;
import com.l2jserver.gameserver.instancemanager.CastleManorManager;
import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.instancemanager.ItemsOnGroundManager;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.instancemanager.RaidBossSpawnManager;
import com.l2jserver.gameserver.instancemanager.leaderboards.*;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Hero;
import com.l2jserver.gameserver.model.entity.event.Hitman;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
import com.l2jserver.gameserver.network.gameserverpackets.ServerStatus;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.util.Broadcast;


/**
 *
 * This class provides the functions for shutting down and restarting the server
 * It closes all open clientconnections and saves all data.
 *
 * @version $Revision: 1.2.4.5 $ $Date: 2005/03/27 15:29:09 $
 */
public class Shutdown extends Thread
{
	private static Logger _log = Logger.getLogger(Shutdown.class.getName());
	private static Shutdown _counterInstance = null;
	
	private int _secondsShut;
	private int _shutdownMode;
	public static final int SIGTERM = 0;
	public static final int GM_SHUTDOWN = 1;
	public static final int GM_RESTART = 2;
	public static final int ABORT = 3;
	private static final String[] MODE_TEXT = { "SIGTERM", "shutting down", "restarting", "aborting" };
	
	/**
	 * This function starts a shutdown countdown from Telnet (Copied from Function startShutdown())
	 *
	 * @param ip IP Which Issued shutdown command
	 * @param seconds seconds untill shutdown
	 * @param restart true if the server will restart after shutdown
	 */
	private void SendServerQuit(int seconds)
	{
		SystemMessage sysm = new SystemMessage(SystemMessageId.THE_SERVER_WILL_BE_COMING_DOWN_IN_S1_SECONDS);
		sysm.addNumber(seconds);
		Broadcast.toAllOnlinePlayers(sysm);
	}
	
	public void startTelnetShutdown(String IP, int seconds, boolean restart)
	{
		_log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
		//_an.announceToAll("Server is " + _modeText[shutdownMode] + " in "+seconds+ " seconds!");
		
		if (restart)
		{
			_shutdownMode = GM_RESTART;
		}
		else
		{
			_shutdownMode = GM_SHUTDOWN;
		}
		
		if (_shutdownMode > 0)
		{
			switch (seconds)
			{
				case 540:
				case 480:
				case 420:
				case 360:
				case 300:
				case 240:
				case 180:
				case 120:
				case 60:
				case 30:
				case 10:
				case 5:
				case 4:
				case 3:
				case 2:
				case 1:
					break;
				default:
					SendServerQuit(seconds);
			}
		}
		
		if (_counterInstance != null)
		{
			_counterInstance._abort();
		}
		_counterInstance = new Shutdown(seconds, restart);
		_counterInstance.start();
	}
	
	/**
	 * This function aborts a running countdown
	 *
	 * @param IP IP Which Issued shutdown command
	 */
	public void telnetAbort(String IP)
	{
		_log.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
		
		if (_counterInstance != null)
		{
			_counterInstance._abort();
			Announcements _an = Announcements.getInstance();
			_an.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!");
		}
	}
	
	/**
	 * Default constucter is only used internal to create the shutdown-hook instance
	 *
	 */
	private Shutdown()
	{
		_secondsShut = -1;
		_shutdownMode = SIGTERM;
	}
	
	/**
	 * This creates a countdown instance of Shutdown.
	 *
	 * @param seconds	how many seconds until shutdown
	 * @param restart	true is the server shall restart after shutdown
	 *
	 */
	public Shutdown(int seconds, boolean restart)
	{
		if (seconds < 0)
		{
			seconds = 0;
		}
		_secondsShut = seconds;
		if (restart)
		{
			_shutdownMode = GM_RESTART;
		}
		else
		{
			_shutdownMode = GM_SHUTDOWN;
		}
	}
	
	/**
	 * get the shutdown-hook instance
	 * the shutdown-hook instance is created by the first call of this function,
	 * but it has to be registrered externaly.
	 *
	 * @return	instance of Shutdown, to be used as shutdown hook
	 */
	public static Shutdown getInstance()
	{
		return SingletonHolder._instance;
	}
	
	/**
	 * this function is called, when a new thread starts
	 *
	 * if this thread is the thread of getInstance, then this is the shutdown hook
	 * and we save all data and disconnect all clients.
	 *
	 * after this thread ends, the server will completely exit
	 *
	 * if this is not the thread of getInstance, then this is a countdown thread.
	 * we start the countdown, and when we finished it, and it was not aborted,
	 * we tell the shutdown-hook why we call exit, and then call exit
	 *
	 * when the exit status of the server is 1, startServer.sh / startServer.bat
	 * will restart the server.
	 *
	 */
	@Override
	public void run()
	{
		if (this == SingletonHolder._instance)
		{
			try
			{
				if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
					OfflineTradersTable.storeOffliners();
			}
			catch (Throwable t)
			{
				_log.log(Level.WARNING, "Error saving offline shops.",t);
			}
			
			try
			{
				_log.info("Disconnecting players...");
				disconnectAllCharacters();
				_log.info("All players disconnected.");
			}
			catch (Throwable t)
			{
				// ignore
			}
			
			// ensure all services are stopped
			try
			{
				GameTimeController.getInstance().stopTimer();
			}
			catch (Throwable t)
			{
				// ignore
			}
			
			// stop all threadpolls
			try
			{
				ThreadPoolManager.getInstance().shutdown();
			}
			catch (Throwable t)
			{
				// ignore
			}
			
			try
			{
				CommunityServerThread.getInstance().interrupt();
			}
			catch (Throwable t)
			{
				// ignore
			}
			
			try
			{
				LoginServerThread.getInstance().interrupt();
			}
			catch (Throwable t)
			{
				// ignore
			}
			
			// last byebye, save all data and quit this server
			saveData();
			
			// saveData sends messages to exit players, so shutdown selector after it
			try
			{
				GameServer.gameServer.getSelectorThread().shutdown();
			}
			catch (Throwable t)
			{
				// ignore
			}
			
			// commit data, last chance
			try
			{
				L2DatabaseFactory.getInstance().shutdown();
			}
			catch (Throwable t)
			{
				
			}
			
			// server will quit, when this function ends.
			if (SingletonHolder._instance._shutdownMode == GM_RESTART)
			{
				Runtime.getRuntime().halt(2);
			}
			else
			{
				Runtime.getRuntime().halt(0);
			}
		}
		else
		{
			// gm shutdown: send warnings and then call exit to start shutdown sequence
			countdown();
			// last point where logging is operational :(
			_log.warning("GM shutdown countdown is over. " + MODE_TEXT[_shutdownMode] + " NOW!");
			switch (_shutdownMode)
			{
				case GM_SHUTDOWN:
					SingletonHolder._instance.setMode(GM_SHUTDOWN);
					System.exit(0);
					break;
				case GM_RESTART:
					SingletonHolder._instance.setMode(GM_RESTART);
					System.exit(2);
					break;
			}
		}
	}
	
	/**
	 * This functions starts a shutdown countdown
	 *
	 * @param activeChar	GM who issued the shutdown command
	 * @param seconds		seconds until shutdown
	 * @param restart		true if the server will restart after shutdown
	 */
	public void startShutdown(L2PcInstance activeChar, int seconds, boolean restart)
	{
		if (restart)
		{
			_shutdownMode = GM_RESTART;
		}
		else
		{
			_shutdownMode = GM_SHUTDOWN;
		}
		
		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown command. "
				+ MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
		
		if (_shutdownMode > 0)
		{
			switch (seconds)
			{
				case 540:
				case 480:
				case 420:
				case 360:
				case 300:
				case 240:
				case 180:
				case 120:
				case 60:
				case 30:
				case 10:
				case 5:
				case 4:
				case 3:
				case 2:
				case 1:
					break;
				default:
					SendServerQuit(seconds);
			}
		}
		
		if (_counterInstance != null)
		{
			_counterInstance._abort();
		}
		
		//		 the main instance should only run for shutdown hook, so we start a new instance
		_counterInstance = new Shutdown(seconds, restart);
		_counterInstance.start();
	}
	
	/**
	 * This function aborts a running countdown
	 *
	 * @param activeChar	GM who issued the abort command
	 */
	public void abort(L2PcInstance activeChar)
	{
		_log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. "
				+ MODE_TEXT[_shutdownMode] + " has been stopped!");
		if (_counterInstance != null)
		{
			_counterInstance._abort();
			Announcements _an = Announcements.getInstance();
			_an.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!");
		}
	}
	
	/**
	 * set the shutdown mode
	 * @param mode	what mode shall be set
	 */
	private void setMode(int mode)
	{
		_shutdownMode = mode;
	}
	
	/**
	 * set shutdown mode to ABORT
	 *
	 */
	private void _abort()
	{
		_shutdownMode = ABORT;
	}
	
	/**
	 * this counts the countdown and reports it to all players
	 * countdown is aborted if mode changes to ABORT
	 */
	private void countdown()
	{
		
		try
		{
			while (_secondsShut > 0)
			{
				
				switch (_secondsShut)
				{
					case 540:
						SendServerQuit(540);
						break;
					case 480:
						SendServerQuit(480);
						break;
					case 420:
						SendServerQuit(420);
						break;
					case 360:
						SendServerQuit(360);
						break;
					case 300:
						SendServerQuit(300);
						break;
					case 240:
						SendServerQuit(240);
						break;
					case 180:
						SendServerQuit(180);
						break;
					case 120:
						SendServerQuit(120);
						break;
					case 60:
						LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_DOWN); //avoids new players from logging in
						SendServerQuit(60);
						break;
					case 30:
						SendServerQuit(30);
						break;
					case 10:
						SendServerQuit(10);
						break;
					case 5:
						SendServerQuit(5);
						break;
					case 4:
						SendServerQuit(4);
						break;
					case 3:
						SendServerQuit(3);
						break;
					case 2:
						SendServerQuit(2);
						break;
					case 1:
						SendServerQuit(1);
						break;
				}
				
				_secondsShut--;
				
				int delay = 1000; //milliseconds
				Thread.sleep(delay);
				
				if (_shutdownMode == ABORT)
					break;
			}
		}
		catch (InterruptedException e)
		{
			//this will never happen
		}
	}
	
	/**
	 * this sends a last byebye, disconnects all players and saves data
	 *
	 */
	private void saveData()
	{
		switch (_shutdownMode)
		{
			case SIGTERM:
				_log.info("SIGTERM received. Shutting down NOW!");
				break;
			case GM_SHUTDOWN:
				_log.info("GM shutdown received. Shutting down NOW!");
				break;
			case GM_RESTART:
				_log.info("GM restart received. Restarting NOW!");
				break;
			
		}
		/* if (Config.ACTIVATE_POSITION_RECORDER)
			Universe.getInstance().implode(true); */
		
		if (Config.RANK_ARENA_ENABLED)
			ArenaLeaderboard.getInstance().stopTask();
		
		if (Config.RANK_FISHERMAN_ENABLED)
			FishermanLeaderboard.getInstance().stopTask();
		
		if (Config.RANK_CRAFT_ENABLED)
			CraftLeaderboard.getInstance().stopTask();
		
		if (Config.RANK_TVT_ENABLED)
			TvTLeaderboard.getInstance().stopTask();
		
		// Seven Signs data is now saved along with Festival data.
		if (!SevenSigns.getInstance().isSealValidationPeriod())
			SevenSignsFestival.getInstance().saveFestivalData(false);
		
		// Save Seven Signs data before closing. :)
		SevenSigns.getInstance().saveSevenSignsData();
		SevenSigns.getInstance().saveSevenSignsStatus();
		
		// Save all raidboss and GrandBoss status ^_^
		RaidBossSpawnManager.getInstance().cleanUp();
		_log.info("RaidBossSpawnManager: All raidboss info saved!!");
		GrandBossManager.getInstance().cleanUp();
		_log.info("GrandBossManager: All Grand Boss info saved!!");
		_log.info("TradeController saving data.. This action may take some minutes! Please wait until completed!");
		TradeController.getInstance().dataCountStore();
		_log.info("TradeController: All count Item Saved");
		Olympiad.getInstance().saveOlympiadStatus();
		_log.info("Olympiad System: Data saved!!");
		Hero.getInstance().shutdown();
		_log.info("Hero System: Data saved!!");
		ClanTable.getInstance().storeClanScore();
		_log.info("Clan System: Data saved!!");
		
		// Save Cursed Weapons data before closing.
		CursedWeaponsManager.getInstance().saveData();
		
		// Save all manor data
		CastleManorManager.getInstance().save();
		
		// Save all global (non-player specific) Quest data that needs to persist after reboot
		QuestManager.getInstance().save();
		
		// Save Hitman Event.
		if(Hitman.start())
			Hitman.getInstance().save();
		
		//Save items on ground before closing
		if (Config.SAVE_DROPPED_ITEM)
		{
			ItemsOnGroundManager.getInstance().saveInDb();
			ItemsOnGroundManager.getInstance().cleanUp();
			_log.info("ItemsOnGroundManager: All items on ground saved!!");
		}
		
		try
		{
			int delay = 5000;
			Thread.sleep(delay);
		}
		catch (InterruptedException e)
		{
			//never happens :p
		}
	}
	
	/**
	 * this disconnects all clients from the server
	 *
	 */
	private void disconnectAllCharacters()
	{
		Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
		{
			for (L2PcInstance player : pls)
			{
				try
				{
					if (player == null)
						return;
					
					player.sendPacket(new SystemMessage(SystemMessageId.YOU_HAVE_BEEN_DISCONNECTED));
					player.logout(false);
				}
				catch (Throwable t)
				{
				}
			}
		}
	}
	
	@SuppressWarnings("synthetic-access")
	private static class SingletonHolder
	{
		protected static final Shutdown _instance = new Shutdown();
	}
}

nery está offline   Responder com Citação
Antigo 29-09-2010, 09:26 AM   #9 (permalink)
Membro - Veterano
 
Avatar de Daniel2
 
Registrado em: Mar 2009
Localização: Cabeça Dentro dos Livros
Posts: 1,322
Agradeceu: 15
Agradecido 474 Vezes em 306 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Pontos: 8,740, Nível: 62
Pontos: 8,740, Nível: 62 Pontos: 8,740, Nível: 62 Pontos: 8,740, Nível: 62
Atividade: 99%
Atividade: 99% Atividade: 99% Atividade: 99%

Nome Real: Daniel Santos

Inventório de Daniel2

Padrão

Citação:
_log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
_an.announceToAll("Server is " + _modeText[shutdownMode] + " in "+seconds+ " seconds!");

if (restart)
{
_shutdownMode = GM_RESTART;
}
else
{
_shutdownMode = GM_SHUTDOWN;
}

if (_shutdownMode > 0)
pior que tem ne mano basta você ser mais atento e procurar estar bem no começo.

Daniel2 está offline   Responder com Citação
Antigo 23-07-2011, 05:41 PM   #10 (permalink)
Membro - Karma
 
Avatar de lucas2008
 
Registrado em: Dec 2008
Posts: 300
Agradeceu: 45
Agradecido 28 Vezes em 21 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Pontos: 4,561, Nível: 43
Pontos: 4,561, Nível: 43 Pontos: 4,561, Nível: 43 Pontos: 4,561, Nível: 43
Atividade: 70%
Atividade: 70% Atividade: 70% Atividade: 70%

Inventório de lucas2008

Padrão

ae,ese codigo ele ussa alguma tecla que assim q vc aperta ele da restar no servidor?
se for alguem poderia postar ela por favor compilada ja usso rev jfrozen, pois to aprendo a mexer com eclipse e ta osso ainda..

lucas2008 está offline   Responder com Citação
Resposta


Regras para Posts
Você não pode postar novos tópicos
Você não pode postar respostas
Você não pode postar anexos
Você não pode editar seus posts

Código [IMG] Sim
Código HTML Não
Trackbacks are Sim
Pingbacks are Sim
Refbacks are Sim



Horários baseados na GMT -3. Agora são 06:48 AM.
 



Search Engine Optimization by vBSEO 3.3.0