Ir para conteúdo
  • Cadastre-se

harleyfilho

Membro
  • Total de itens

    33
  • Registro em

  • Última visita

Sobre harleyfilho

Profile Information

  • Gênero
    Masculino

Últimos Visitantes

1817 visualizações

harleyfilho's Achievements

Aprendiz de Novato

Aprendiz de Novato (1/14)

11

Reputação

  1. harleyfilho

    Restart automatico

    Tem o MOD "nao tenho os creditos" ### Eclipse Workspace Patch 1.0 #P L2jFrozen_GameServer Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 983) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -2129,6 +2129,9 @@ public static String PM_TEXT1; public static String PM_TEXT2; public static boolean NEW_PLAYER_EFFECT; + public static boolean RESTART_BY_TIME_OF_DAY; + public static int RESTART_SECONDS; + public static String[] RESTART_INTERVAL_BY_TIME_OF_DAY; //============================================================ @@ -2151,7 +2154,11 @@ PM_TEXT1 = frozenSettings.getProperty("PMText1", "Have Fun and Nice Stay on"); PM_TEXT2 = frozenSettings.getProperty("PMText2", "Vote for us every 24h"); NEW_PLAYER_EFFECT = Boolean.parseBoolean(frozenSettings.getProperty("NewPlayerEffect", "True")); + RESTART_BY_TIME_OF_DAY = Boolean.parseBoolean(frozenSettings.getProperty("EnableRestartSystem", "false")); + RESTART_SECONDS = Integer.parseInt(frozenSettings.getProperty("RestartSeconds", "360")); + RESTART_INTERVAL_BY_TIME_OF_DAY = frozenSettings.getProperty("RestartByTimeOfDay", "20:00").split(","); + } catch(Exception e) { Index: head-src/com/l2jfrozen/gameserver/GameServer.java =================================================================== --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 983) +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy) @@ -561,7 +561,15 @@ if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS) OfflineTradeTable.restoreOfflineTraders(); - + + 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("Info"); _log.info("Operating System: " + Util.getOSName() + " " + Util.getOSVersion() + " " + Util.getOSArch()); _log.info("Available CPUs: " + Util.getAvailableProcessors()); Index: head-src/com/l2jfrozen/gameserver/Shutdown.java =================================================================== --- head-src/com/l2jfrozen/gameserver/Shutdown.java (revision 983) +++ head-src/com/l2jfrozen/gameserver/Shutdown.java (working copy) @@ -170,7 +170,19 @@ _counterInstance._abort(); } } - + + public void autoRestart(int time) + { + _secondsShut = time; + + countdown(); + + _shutdownMode = GM_RESTART; + + _instance.setMode(GM_RESTART); + System.exit(2); + } + /** * Default constructor is only used internal to create the shutdown-hook instance */ Index: head-src/com/l2jfrozen/gameserver/Restart.java =================================================================== --- head-src/com/l2jfrozen/gameserver/Restart.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/Restart.java (working copy) @@ -0,0 +1,109 @@ +package com.l2jfrozen.gameserver; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.logging.Logger; + +import com.l2jfrozen.Config; +import com.l2jfrozen.gameserver.thread.ThreadPoolManager; + +/** + * This Config for Auto Restart GameServer Initialize class getInstance() Set Time in Config File Thank You L2JServer | L2JRussia + * @author L2JRussia + */ +public class Restart +{ + // Variaveis globais + private static Restart _instance = null; + protected static final Logger _log = Logger.getLogger(Restart.class.getName()); + private Calendar NextRestart; + private final 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() + { + _log.info("#####################################"); + _log.info("#[Restart System]: System actived...#"); + _log.info("#####################################"); + 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("[AutoRestart]: 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: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 983) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy) @@ -26,6 +26,7 @@ import com.l2jfrozen.Config; import com.l2jfrozen.crypt.nProtect; import com.l2jfrozen.crypt.nProtect.RestrictionType; +import com.l2jfrozen.gameserver.Restart; import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager; import com.l2jfrozen.gameserver.controllers.GameTimeController; import com.l2jfrozen.gameserver.datatables.CharSchemesTable; @@ -467,6 +468,11 @@ } } } + + if(Config.RESTART_BY_TIME_OF_DAY) + { + ShowNextRestart(activeChar); + } // NPCBuffer if (PowerPakConfig.BUFFER_ENABLED) @@ -819,7 +825,18 @@ } } } - + + /** + * Envia mensagem para o player do proximo restart + * NOTE: RESTART_BY_TIME_OF_DAY = TRUE + * + * @param activeChar + */ + private void ShowNextRestart(L2PcInstance activeChar) + { + activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime()); + } + @Override public String getType() { Index: config/frozen/frozen.properties =================================================================== --- config/frozen/frozen.properties (revision 983) +++ config/frozen/frozen.properties (working copy) @@ -21,4 +21,20 @@ # New players get fireworks the first time they log in # Default: False -NewPlayerEffect = False \ No newline at end of file +NewPlayerEffect = False + +########################################### +# Automated restart config # +# Mod exclusive L2JFrozen # +# ######################################### +# Enable / Disable Restart Auto +EnableRestartSystem = False + +# 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
  2. Muito bom amigo, só uma dúvida tem com comando //sethero + nome +dias ?
  3. sim importar como projeto java.
  4. OK Vou tenta adaptar. Oi bom dia eu não estou achando o caminho (java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminOlympiad.java) para frozen 1132 me ajudar, já fiz ate search no eclipse, so falta essa parte para ver se o mod pega. ou min fala onde fica o comando admin_sethero nessa rev doida kkk pode deixa quando eu fiz o search não coloquei a opção .java rsrs achei :kkk: esqueçe aff não conseguir fazer fiz so ate metade chegou em uma parte q o mod parece não dava pra adaptar, ver se vc conseguer adaptar pra min ?
  5. Ok amigo 1° vai na pasta onde você salva seus projetos. exemplo:C:\Users\Harley\workspace 2° nesta pasta vão estar os projetos que você trabalha. exemplo: 3° Basta você salva-las em um pendrive ou colocar em um server could tipo o Ondrive ou mega.nz. Eu faço assim :aqui: :O
  6. Como faço para arruma esses erros, todos os erros dão na mesma coisa @SuppressWarnings("null")
  7. Ok vou fazer o up jaja posto aqui Segue ai mano eu uso essa no meu server ta pegando de boa eu só editei os ID's dela ja ta tudo configurado... https://mega.nz/#!G8N3EABS!rlKil0YhZOENJHD2VlE4KnEUaNKdPqV4M_DRCqMu-JU
  8. Bom dia, minha rev só pega os comando //sethero = hero eterno e //sethero 0 = remover hero, queria adicionar o comando //sethero + nome + dias, alguém pode me ajudar ?
  9. Tenta assim amigo, se você quiser eu coloco um up dessas armas para você tudo editado e pegando já. Também pode ser sua DB.
  10. Obrigado Tayran como você me orientou, já estou estudando.
  11. vlw, mais eu coloquei o arquivo assim para ter uma melhor compreensão do assunto tratado :durmir: Vlw Tayran você vai me ajudar muito ainda rsrsrs.
  12. kkkkk ok Crie um tópico sobre nosso assunto coloquei seus créditos por te me ajudado, se já tiver no fórum você pode retirar, por quer eu procurei e não achei. https://www.l2jbrasil.com/index.php?/topic/122642-tutorial-como-troca-o-nome-da-pasta-frozen/
×
×
  • Criar Novo...

Important Information

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.