U3Games
Lineage II | Desarrollo & Soporte => Desarrollo de Servidores => Implementaciones => Mensaje iniciado por: Swarlog en Ago 19, 2022, 01:20 AM
CitarCORE:
Index: com/l2jserver/Config.java
===================================================================
--- com/l2jserver/Config.java (revision 4410)
+++ com/l2jserver/Config.java (working copy)
@@ -398,6 +398,7 @@
public static boolean ALT_DEV_NO_HANDLERS;
public static boolean ALT_DEV_NO_QUESTS;
public static boolean ALT_DEV_NO_SPAWNS;
+ public static boolean ALT_DEV_NO_CRON;
public static boolean SERVER_LIST_TESTSERVER;
public static int THREAD_P_EFFECTS;
public static int THREAD_P_GENERAL;
@@ -1668,6 +1675,7 @@
ALT_DEV_NO_HANDLERS = Boolean.parseBoolean(General.getProperty("AltDevNoHandlers", "False"));
ALT_DEV_NO_QUESTS = Boolean.parseBoolean(General.getProperty("AltDevNoQuests", "False"));
ALT_DEV_NO_SPAWNS = Boolean.parseBoolean(General.getProperty("AltDevNoSpawns", "False"));
+ ALT_DEV_NO_CRON = Boolean.parseBoolean(General.getProperty("AltDevNoCron", "False"));
THREAD_P_EFFECTS = Integer.parseInt(General.getProperty("ThreadPoolSizeEffects", "10"));
THREAD_P_GENERAL = Integer.parseInt(General.getProperty("ThreadPoolSizeGeneral", "13"));
IO_PACKET_THREAD_CORE_SIZE = Integer.parseInt(General.getProperty("UrgentPacketThreadCoreSize", "2"));
Index: com/l2jserver/gameserver/GameServer.java
===================================================================
--- com/l2jserver/gameserver/GameServer.java (revision 4410)
+++ com/l2jserver/gameserver/GameServer.java (working copy)
@@ -464,6 +467,20 @@
_log.info("Server Loaded in " + ((serverLoadEnd - serverLoadStart) / 1000) + " seconds");
AutoAnnounceTaskManager.getInstance();
+
+ try
+ {
+ _log.info("Loading Cron Scripts...");
+ File cron = new File(Config.DATAPACK_ROOT + "/data/cron.cfg");
+ if(!Config.ALT_DEV_NO_CRON)
+ L2ScriptEngineManager.getInstance().executeScriptList(cron);
+ else
+ _log.info("Loading Cron Scripts disabled by alternative configuration.");
+ }
+ catch (IOException ioe)
+ {
+ _log.severe("Failed loading cron.cfg, no script going to be loaded");
+ }
}
public static void main(String[] args) throws Exception
\ No newline at end of file
Index: config/General.properties
===================================================================
--- config/General.properties (revision 4410)
+++ config/General.properties (working copy)
@@ -758,4 +758,8 @@
# Don't load spawntable.
# Default: False
AltDevNoSpawns = False
+
+# Don't load cron.cfg
+# Default: False
+AltDevNoCron = False
\ No newline at end of file
CitarDATA:
### Eclipse Workspace Patch 1.0
#P gameserver
Index: data/scripts/cron/OfflineTradeStore.java
===================================================================
--- data/scripts/cron/OfflineTradeStore.java (revision 0)
+++ data/scripts/cron/OfflineTradeStore.java (revision 0)
@@ -0,0 +1,49 @@
+package cron;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.datatables.OfflineTradersTable;
+
+/**
+ * @author denser
+ * @author ThE_PuNiSheR
+ */
+public class OfflineTradeStore
+{
+ public static final Logger _log = Logger.getLogger(OfflineTradeStore.class.getName());
+ private long _init = 0;
+ private long _delay = 1000 * 60 * 15;
+
+ public OfflineTradeStore()
+ {
+ ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new store(), _init, _delay);
+ }
+
+ private class store implements Runnable
+ {
+ public void run()
+ {
+ try
+ {
+ if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
+ {
+ OfflineTradersTable.storeOffliners();
+ _log.info("Offline traders stored via cron!");
+ }
+ }
+ catch (Throwable t)
+ {
+ _log.log(Level.WARNING, "Error saving offline shops.", t);
+ }
+ }
+ }
+
+
+ public static void main(String[] args)
+ {
+ new OfflineTradeStore();
+ }
+}
\ No newline at end of file
Index: data/cron.cfg
===================================================================
--- data/cron.cfg (revision 0)
+++ data/cron.cfg (revision 0)
@@ -0,0 +1,4 @@
+# Feel free to add here your own scripts
+
+# CRON
+cron/OfflineTradeStore.java
\ No newline at end of file