diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/protected/Daemons.ini b/L2J_Mobius_C6_Interlude/dist/game/config/protected/Daemons.ini index b70c661bdd..27860d20fe 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/config/protected/Daemons.ini +++ b/L2J_Mobius_C6_Interlude/dist/game/config/protected/Daemons.ini @@ -10,29 +10,6 @@ # DeadLockCheck = -1 # Now the demon-stream after completing his tasks will disappear forever. -# AUTO SAVE DAEMON: -# Allows you to customize the preservation of the database of players. -AutoSaveInitial = 300000 -AutoSaveDelay = 900000 - -# CHECK CONNECTION DAEMON: -# Allows you to customize the connection check of players. -CheckConnectionInitial = 300000 -CheckConnectionDelay = 900000 -# Maximum time without receiving packets from client needed to be checked -# Default: 60sec -CheckConnectionInactivityTime = 60000 - -# CHECK TELEPORT ZOMBIE STATUS: -# Allow to close connection of "teleport zombies" due to critical errors on teleport -# Default: 60sec -CheckTeleportZombiesDelay = 60000 - -# Clean database task delay: -CleanDBInitial = 300000 -CleanDBDelay = 900000 - - # --------------------------------------------------------------------------- # Dead Lock Detector (separate thread for detecting deadlocks) # --------------------------------------------------------------------------- diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java index f545e04028..f615d938df 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java @@ -1120,14 +1120,6 @@ public class Config public static ClassMasterSettings CLASS_MASTER_SETTINGS; public static boolean ALLOW_REMOTE_CLASS_MASTERS; - public static long AUTOSAVE_INITIAL_TIME; - public static long AUTOSAVE_DELAY_TIME; - public static long CHECK_CONNECTION_INACTIVITY_TIME; - public static long CHECK_CONNECTION_INITIAL_TIME; - public static long CHECK_CONNECTION_DELAY_TIME; - public static long CLEANDB_INITIAL_TIME; - public static long CLEANDB_DELAY_TIME; - public static long CHECK_TELEPORT_ZOMBIE_DELAY_TIME; public static long DEADLOCKCHECK_INTIAL_TIME; public static long DEADLOCKCHECK_DELAY_TIME; @@ -3491,14 +3483,6 @@ public class Config { final L2Properties daemonsSettings = new L2Properties(DAEMONS_CONFIG_FILE); - AUTOSAVE_INITIAL_TIME = Long.parseLong(daemonsSettings.getProperty("AutoSaveInitial", "300000")); - AUTOSAVE_DELAY_TIME = Long.parseLong(daemonsSettings.getProperty("AutoSaveDelay", "900000")); - CHECK_CONNECTION_INITIAL_TIME = Long.parseLong(daemonsSettings.getProperty("CheckConnectionInitial", "300000")); - CHECK_CONNECTION_DELAY_TIME = Long.parseLong(daemonsSettings.getProperty("CheckConnectionDelay", "900000")); - CHECK_CONNECTION_INACTIVITY_TIME = Long.parseLong(daemonsSettings.getProperty("CheckConnectionInactivityTime", "90000")); - CLEANDB_INITIAL_TIME = Long.parseLong(daemonsSettings.getProperty("CleanDBInitial", "300000")); - CLEANDB_DELAY_TIME = Long.parseLong(daemonsSettings.getProperty("CleanDBDelay", "900000")); - CHECK_TELEPORT_ZOMBIE_DELAY_TIME = Long.parseLong(daemonsSettings.getProperty("CheckTeleportZombiesDelay", "90000")); DEADLOCKCHECK_INTIAL_TIME = Long.parseLong(daemonsSettings.getProperty("DeadLockCheck", "0")); DEADLOCKCHECK_DELAY_TIME = Long.parseLong(daemonsSettings.getProperty("DeadLockDelay", "0")); } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java index 908b69057f..86c313000e 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/GameServer.java @@ -85,7 +85,6 @@ import org.l2jmobius.gameserver.handler.UserCommandHandler; import org.l2jmobius.gameserver.handler.VoicedCommandHandler; import org.l2jmobius.gameserver.idfactory.IdFactory; import org.l2jmobius.gameserver.instancemanager.AuctionManager; -import org.l2jmobius.gameserver.instancemanager.AutoSaveManager; import org.l2jmobius.gameserver.instancemanager.AwayManager; import org.l2jmobius.gameserver.instancemanager.CastleManager; import org.l2jmobius.gameserver.instancemanager.CastleManorManager; @@ -223,11 +222,6 @@ public class GameServer ClassDamageManager.loadConfig(); } - if (Config.AUTOSAVE_DELAY_TIME > 0) - { - AutoSaveManager.getInstance().startAutoSaveManager(); - } - Util.printSection("Skills"); if (!SkillTable.getInstance().isInitialized()) { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/Shutdown.java index c98d3c2d4d..cff7518909 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/Shutdown.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/Shutdown.java @@ -24,7 +24,6 @@ import org.l2jmobius.commons.database.DatabaseBackup; import org.l2jmobius.commons.database.DatabaseFactory; import org.l2jmobius.gameserver.datatables.OfflineTradeTable; import org.l2jmobius.gameserver.datatables.SchemeBufferTable; -import org.l2jmobius.gameserver.instancemanager.AutoSaveManager; import org.l2jmobius.gameserver.instancemanager.CastleManorManager; import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager; import org.l2jmobius.gameserver.instancemanager.FishingChampionshipManager; @@ -303,8 +302,6 @@ public class Shutdown extends Thread { } - AutoSaveManager.getInstance().stopAutoSaveManager(); - // saveData sends messages to exit players, so shutdown selector after it saveData(); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/AutoSaveManager.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/AutoSaveManager.java deleted file mode 100644 index 22a7b59a9e..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/instancemanager/AutoSaveManager.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * 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 org.l2jmobius.gameserver.instancemanager; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.util.Collection; -import java.util.concurrent.ScheduledFuture; -import java.util.logging.Logger; - -import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; -import org.l2jmobius.commons.database.DatabaseFactory; -import org.l2jmobius.gameserver.model.World; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; - -/** - * @author Shyla - */ -public class AutoSaveManager -{ - protected static final Logger LOGGER = Logger.getLogger(AutoSaveManager.class.getName()); - private ScheduledFuture _autoSaveInDB; - private ScheduledFuture _autoCheckConnectionStatus; - private ScheduledFuture _autoCleanDatabase; - - public static final AutoSaveManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - public AutoSaveManager() - { - LOGGER.info("Initializing AutoSaveManager"); - } - - public void stopAutoSaveManager() - { - if (_autoSaveInDB != null) - { - _autoSaveInDB.cancel(true); - _autoSaveInDB = null; - } - - if (_autoCheckConnectionStatus != null) - { - _autoCheckConnectionStatus.cancel(true); - _autoCheckConnectionStatus = null; - } - if (_autoCleanDatabase != null) - { - _autoCleanDatabase.cancel(true); - _autoCleanDatabase = null; - } - } - - public void startAutoSaveManager() - { - stopAutoSaveManager(); - _autoSaveInDB = ThreadPool.scheduleAtFixedRate(new AutoSaveTask(), Config.AUTOSAVE_INITIAL_TIME, Config.AUTOSAVE_DELAY_TIME); - _autoCheckConnectionStatus = ThreadPool.scheduleAtFixedRate(new ConnectionCheckTask(), Config.CHECK_CONNECTION_INITIAL_TIME, Config.CHECK_CONNECTION_DELAY_TIME); - _autoCleanDatabase = ThreadPool.scheduleAtFixedRate(new AutoCleanDBTask(), Config.CLEANDB_INITIAL_TIME, Config.CLEANDB_DELAY_TIME); - } - - protected class AutoSaveTask implements Runnable - { - @Override - public void run() - { - int playerscount = 0; - - final Collection players = World.getInstance().getAllPlayers(); - - for (PlayerInstance player : players) - { - if (player != null) - { - try - { - playerscount++; - player.store(); - } - catch (Exception e) - { - LOGGER.warning("Error saving player character: " + player.getName() + " " + e); - } - } - } - LOGGER.info("[AutoSaveManager] AutoSaveTask, " + playerscount + " players data saved."); - } - } - - protected class ConnectionCheckTask implements Runnable - { - @Override - public void run() - { - final Collection players = World.getInstance().getAllPlayers(); - - for (PlayerInstance player : players) - { - if ((player != null) && !player.isInOfflineMode()) - { - if ((player.getClient() == null) || (player.isOnline() == 0)) - { - LOGGER.info("[AutoSaveManager] Player " + player.getName() + " status == 0 ---> Closing Connection.."); - player.store(); - player.deleteMe(); - } - else if (!player.getClient().isConnectionAlive()) - { - try - { - LOGGER.info("[AutoSaveManager] Player " + player.getName() + " connection is not alive ---> Closing Connection.."); - player.getClient().onDisconnection(); - } - catch (Exception e) - { - LOGGER.warning("[AutoSaveManager] Error saving player character: " + player.getName() + " " + e); - } - } - else if (player.checkTeleportOverTime()) - { - try - { - LOGGER.info("[AutoSaveManager] Player " + player.getName() + " has a teleport overtime ---> Closing Connection.."); - player.getClient().onDisconnection(); - } - catch (Exception e) - { - LOGGER.warning("[AutoSaveManager] Error saving player character: " + player.getName() + " " + e); - } - } - } - } - LOGGER.info("[AutoSaveManager] ConnectionCheckTask, players connections checked."); - } - } - - protected class AutoCleanDBTask implements Runnable - { - @Override - public void run() - { - int erased = 0; - - // Perform the clean here instead of every time that the skills are saved in order to do it in once step because if skill have 0 reuse delay doesn't affect the game, just makes the table grows bigger - try (Connection con = DatabaseFactory.getConnection()) - { - PreparedStatement statement; - statement = con.prepareStatement("DELETE FROM character_skills_save WHERE reuse_delay=0 && restore_type=1"); - erased = statement.executeUpdate(); - statement.close(); - } - catch (Exception e) - { - LOGGER.info("[AutoSaveManager] Error while cleaning skill with 0 reuse time from table."); - } - - LOGGER.info("[AutoSaveManager] AutoCleanDBTask, " + erased + " entries cleaned from db."); - } - } - - private static class SingletonHolder - { - protected static final AutoSaveManager INSTANCE = new AutoSaveManager(); - } -} \ No newline at end of file diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 7db91642c6..64d52f196e 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -281,7 +281,6 @@ public class PlayerInstance extends Playable private long _voteTimestamp = 0; private PlayerStatsHolder savedStatus = null; private final long _instanceLoginTime; - private long _lastTeleportAction = 0; protected long TOGGLE_USE = 0; public int _activeBoxes = -1; public List _activeBoxeCharacters = new ArrayList<>(); @@ -9387,7 +9386,6 @@ public class PlayerInstance extends Playable } } - @SuppressWarnings("null") private synchronized void storeEffect() { if (!Config.STORE_SKILL_COOLTIME) @@ -9423,7 +9421,7 @@ public class PlayerInstance extends Playable } storedSkills.add(skillId); - if ((effect != null) && effect.getInUse() && !effect.getSkill().isToggle() && !effect.getStackType().equals("BattleForce") && !effect.getStackType().equals("SpellForce") && (effect.getSkill().getSkillType() != SkillType.FORCE_BUFF)) + if (effect.getInUse() && !effect.getSkill().isToggle() && !effect.getStackType().equals("BattleForce") && !effect.getStackType().equals("SpellForce") && (effect.getSkill().getSkillType() != SkillType.FORCE_BUFF)) { statement.setInt(1, getObjectId()); statement.setInt(2, skillId); @@ -17249,33 +17247,6 @@ public class PlayerInstance extends Playable } } - public boolean checkTeleportOverTime() - { - if (!isTeleporting()) - { - return false; - } - - if ((System.currentTimeMillis() - _lastTeleportAction) > Config.CHECK_TELEPORT_ZOMBIE_DELAY_TIME) - { - LOGGER.warning("Player " + getName() + " has been in teleport more then " + (Config.CHECK_TELEPORT_ZOMBIE_DELAY_TIME / 1000) + " seconds.. --> Kicking it"); - - return true; - } - - return false; - } - - @Override - public void setTeleporting(boolean value) - { - super.setTeleporting(value); - if (value) - { - _lastTeleportAction = System.currentTimeMillis(); - } - } - @Override public PlayerInstance getActingPlayer() { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java index d168b423c7..1b87e74490 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/GameClient.java @@ -115,8 +115,6 @@ public class GameClient extends MMOClient> implements private final ArrayBlockingQueue> _packetQueue; private final ReentrantLock _queueLock = new ReentrantLock(); - private long _last_received_packet_action_time = 0; - private int _protocolVersion; public GameClient(MMOConnection con) @@ -929,9 +927,6 @@ public class GameClient extends MMOClient> implements return; } - // save last action time - _last_received_packet_action_time = System.currentTimeMillis(); - try { if (_state == GameClientState.CONNECTED) @@ -1002,24 +997,11 @@ public class GameClient extends MMOClient> implements } } - /** - * @return the _forcedToClose - */ public boolean isForcedToClose() { return _forcedToClose; } - public boolean isConnectionAlive() - { - if ((System.currentTimeMillis() - _last_received_packet_action_time) > Config.CHECK_CONNECTION_INACTIVITY_TIME) - { - _last_received_packet_action_time = System.currentTimeMillis(); - return getConnection().isConnected() && !getConnection().isClosed(); - } - return true; - } - public void setProtocolVersion(int version) { _protocolVersion = version;