Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P l2jalpha_gameserver_mxc
- Index: java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -27,6 +27,7 @@
- import net.l2jalpha.gameserver.Announcements;
- import net.l2jalpha.gameserver.GmListTable;
- import net.l2jalpha.gameserver.TaskPriority;
- +import net.l2jalpha.gameserver.ThreadPoolManager;
- import net.l2jalpha.gameserver.cache.HtmCache;
- import net.l2jalpha.gameserver.communitybbs.Manager.RegionBBSManager;
- import net.l2jalpha.gameserver.datatables.sql.AdminCommandAccessRights;
- @@ -45,6 +46,7 @@
- import net.l2jalpha.gameserver.model.base.PlayerClass;
- import net.l2jalpha.gameserver.model.entity.ClanHall;
- import net.l2jalpha.gameserver.model.entity.Hero;
- +import net.l2jalpha.gameserver.model.entity.LeaveBuster;
- import net.l2jalpha.gameserver.model.entity.Siege;
- import net.l2jalpha.gameserver.model.olympiad.Olympiad;
- import net.l2jalpha.gameserver.model.quest.Quest;
- @@ -281,6 +283,8 @@
- RegionBBSManager.getInstance().changeCommunityBoard();
- + activeChar.setLastActionMillis(System.currentTimeMillis());
- + LeaveBuster._players.put(activeChar, ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new LeaveBuster(activeChar), 5000, 5000));
- }
- /**
- Index: java/net/l2jalpha/gameserver/network/clientpackets/Logout.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (working copy)
- @@ -27,6 +27,7 @@
- import net.l2jalpha.gameserver.datatables.xml.SkillTable;
- import net.l2jalpha.gameserver.model.L2World;
- import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +import net.l2jalpha.gameserver.model.entity.LeaveBuster;
- import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
- import net.l2jalpha.gameserver.network.SystemMessageId;
- import net.l2jalpha.gameserver.network.serverpackets.ActionFailed;
- @@ -56,6 +57,8 @@
- if (player == null)
- return;
- +
- + player.setLastActionMillis(System.currentTimeMillis());
- player.getInventory().updateDatabase();
- @@ -79,6 +82,9 @@
- {
- player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
- }
- +
- + LeaveBuster._players.get(player).cancel(true);;
- + LeaveBuster._players.remove(player);
- RegionBBSManager.getInstance().changeCommunityBoard();
- Index: java/net/l2jalpha/gameserver/network/clientpackets/Say2.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/Say2.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/Say2.java (working copy)
- @@ -113,6 +113,8 @@
- return;
- }
- + activeChar.setLastActionMillis(System.currentTimeMillis());
- +
- if (_text.length() >= 100)
- {
- _log.warning("Say2: Max input exceeded.");
- Index: java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java (revision 31)
- +++ java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -196,6 +196,19 @@
- */
- public final class L2PcInstance extends L2Playable
- {
- + // LeaveBuster
- + private long _lastAction = 0;
- +
- + public long getLastActionMillis()
- + {
- + return _lastAction;
- + }
- +
- + public void setLastActionMillis(long val)
- + {
- + _lastAction = val;
- + }
- +
- private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
- private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,skill_name,class_index) VALUES (?,?,?,?,?)";
- private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?";
- Index: java/net/l2jalpha/gameserver/model/entity/LeaveBuster.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/entity/LeaveBuster.java (revision 0)
- +++ java/net/l2jalpha/gameserver/model/entity/LeaveBuster.java (working copy)
- @@ -0,0 +1,65 @@
- +/* 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 2, 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, 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.l2jalpha.gameserver.model.entity;
- +
- +import java.util.concurrent.ScheduledFuture;
- +import java.util.logging.Logger;
- +
- +import javolution.util.FastMap;
- +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class LeaveBuster implements Runnable
- +{
- + public static FastMap<L2PcInstance, ScheduledFuture<?>> _players = new FastMap<>();
- +
- + private static final Logger _log = Logger.getLogger(LeaveBuster.class.getName());
- +
- + private L2PcInstance _p = null;
- +
- + public LeaveBuster(L2PcInstance p)
- + {
- + _p = p;
- + }
- +
- + @Override
- + public void run()
- + {
- + if (_p == null || !_p.isOnline())
- + {
- + if (_p != null)
- + {
- + _players.get(_p).cancel(true);
- + _players.remove(_p);
- + }
- +
- + return;
- + }
- +
- + if ((System.currentTimeMillis()-_p.getLastActionMillis())/1000/60 >= 30)
- + {
- + _log.info("Leave Buster: "+_p.getName()+" was kicked out of game.");
- + _players.get(_p).cancel(true);
- + _players.remove(_p);
- + _p.logout();
- + }
- + }
- +}
- Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (working copy)
- @@ -22,6 +22,7 @@
- import net.l2jalpha.gameserver.communitybbs.Manager.RegionBBSManager;
- import net.l2jalpha.gameserver.datatables.xml.SkillTable;
- import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +import net.l2jalpha.gameserver.model.entity.LeaveBuster;
- import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
- import net.l2jalpha.gameserver.network.L2GameClient;
- import net.l2jalpha.gameserver.network.SystemMessageId;
- @@ -56,6 +57,8 @@
- _log.warning("[RequestRestart] activeChar null!?");
- return;
- }
- +
- + player.setLastActionMillis(System.currentTimeMillis());
- if (player.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(player))
- {
- @@ -92,6 +95,9 @@
- {
- player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
- }
- +
- + LeaveBuster._players.get(player).cancel(true);;
- + LeaveBuster._players.remove(player);
- L2GameClient client = getClient();
- Index: java/net/l2jalpha/gameserver/network/clientpackets/MoveBackwardToLocation.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/MoveBackwardToLocation.java (working copy)
- @@ -91,6 +91,8 @@
- L2PcInstance activeChar = getClient().getActiveChar();
- if (activeChar == null)
- return;
- +
- + activeChar.setLastActionMillis(System.currentTimeMillis());
- _curX = activeChar.getX();
- _curY = activeChar.getY();
- Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestRestartPoint.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/RequestRestartPoint.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestRestartPoint.java (working copy)
- @@ -160,6 +160,8 @@
- if (activeChar == null)
- return;
- +
- + activeChar.setLastActionMillis(System.currentTimeMillis());
- //SystemMessage sm2 = new SystemMessage(SystemMessage.S1_S2);
- //sm2.addString("type:"+requestedPointType);
- Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestSocialAction.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/RequestSocialAction.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestSocialAction.java (working copy)
- @@ -49,6 +49,8 @@
- L2PcInstance activeChar = getClient().getActiveChar();
- if (activeChar == null)
- return;
- +
- + activeChar.setLastActionMillis(System.currentTimeMillis());
- // check if its the actionId is allowed
- if (_actionId < 2 || _actionId > 13)
- Index: java/net/l2jalpha/gameserver/network/clientpackets/TradeRequest.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/TradeRequest.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/TradeRequest.java (working copy)
- @@ -52,6 +52,8 @@
- if (player == null)
- return;
- +
- + player.setLastActionMillis(System.currentTimeMillis());
- if (!player.getAccessLevel().allowTransaction())
- {
- Index: java/net/l2jalpha/gameserver/network/clientpackets/UseItem.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/UseItem.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/UseItem.java (working copy)
- @@ -63,6 +63,8 @@
- if (activeChar == null)
- return;
- +
- + activeChar.setLastActionMillis(System.currentTimeMillis());
- // Flood protect UseItem
- if (!getClient().getFloodProtectors().getUseItem().tryPerformAction("use item"))
Advertisement
Add Comment
Please, Sign In to add comment