Guest User

Untitled

a guest
Jul 5th, 2013
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.52 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P l2jalpha_gameserver_mxc
  3. Index: java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java
  4. ===================================================================
  5. --- java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java (revision 31)
  6. +++ java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java (working copy)
  7. @@ -27,6 +27,7 @@
  8. import net.l2jalpha.gameserver.Announcements;
  9. import net.l2jalpha.gameserver.GmListTable;
  10. import net.l2jalpha.gameserver.TaskPriority;
  11. +import net.l2jalpha.gameserver.ThreadPoolManager;
  12. import net.l2jalpha.gameserver.cache.HtmCache;
  13. import net.l2jalpha.gameserver.communitybbs.Manager.RegionBBSManager;
  14. import net.l2jalpha.gameserver.datatables.sql.AdminCommandAccessRights;
  15. @@ -45,6 +46,7 @@
  16. import net.l2jalpha.gameserver.model.base.PlayerClass;
  17. import net.l2jalpha.gameserver.model.entity.ClanHall;
  18. import net.l2jalpha.gameserver.model.entity.Hero;
  19. +import net.l2jalpha.gameserver.model.entity.LeaveBuster;
  20. import net.l2jalpha.gameserver.model.entity.Siege;
  21. import net.l2jalpha.gameserver.model.olympiad.Olympiad;
  22. import net.l2jalpha.gameserver.model.quest.Quest;
  23. @@ -281,6 +283,8 @@
  24.  
  25. RegionBBSManager.getInstance().changeCommunityBoard();
  26.  
  27. + activeChar.setLastActionMillis(System.currentTimeMillis());
  28. + LeaveBuster._players.put(activeChar, ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new LeaveBuster(activeChar), 5000, 5000));
  29. }
  30.  
  31. /**
  32. Index: java/net/l2jalpha/gameserver/network/clientpackets/Logout.java
  33. ===================================================================
  34. --- java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (revision 31)
  35. +++ java/net/l2jalpha/gameserver/network/clientpackets/Logout.java (working copy)
  36. @@ -27,6 +27,7 @@
  37. import net.l2jalpha.gameserver.datatables.xml.SkillTable;
  38. import net.l2jalpha.gameserver.model.L2World;
  39. import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  40. +import net.l2jalpha.gameserver.model.entity.LeaveBuster;
  41. import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
  42. import net.l2jalpha.gameserver.network.SystemMessageId;
  43. import net.l2jalpha.gameserver.network.serverpackets.ActionFailed;
  44. @@ -56,6 +57,8 @@
  45.  
  46. if (player == null)
  47. return;
  48. +
  49. + player.setLastActionMillis(System.currentTimeMillis());
  50.  
  51. player.getInventory().updateDatabase();
  52.  
  53. @@ -79,6 +82,9 @@
  54. {
  55. player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
  56. }
  57. +
  58. + LeaveBuster._players.get(player).cancel(true);;
  59. + LeaveBuster._players.remove(player);
  60.  
  61. RegionBBSManager.getInstance().changeCommunityBoard();
  62.  
  63. Index: java/net/l2jalpha/gameserver/network/clientpackets/Say2.java
  64. ===================================================================
  65. --- java/net/l2jalpha/gameserver/network/clientpackets/Say2.java (revision 31)
  66. +++ java/net/l2jalpha/gameserver/network/clientpackets/Say2.java (working copy)
  67. @@ -113,6 +113,8 @@
  68. return;
  69. }
  70.  
  71. + activeChar.setLastActionMillis(System.currentTimeMillis());
  72. +
  73. if (_text.length() >= 100)
  74. {
  75. _log.warning("Say2: Max input exceeded.");
  76. Index: java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java
  77. ===================================================================
  78. --- java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java (revision 31)
  79. +++ java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  80. @@ -196,6 +196,19 @@
  81. */
  82. public final class L2PcInstance extends L2Playable
  83. {
  84. + // LeaveBuster
  85. + private long _lastAction = 0;
  86. +
  87. + public long getLastActionMillis()
  88. + {
  89. + return _lastAction;
  90. + }
  91. +
  92. + public void setLastActionMillis(long val)
  93. + {
  94. + _lastAction = val;
  95. + }
  96. +
  97. private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
  98. private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,skill_name,class_index) VALUES (?,?,?,?,?)";
  99. private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?";
  100. Index: java/net/l2jalpha/gameserver/model/entity/LeaveBuster.java
  101. ===================================================================
  102. --- java/net/l2jalpha/gameserver/model/entity/LeaveBuster.java (revision 0)
  103. +++ java/net/l2jalpha/gameserver/model/entity/LeaveBuster.java (working copy)
  104. @@ -0,0 +1,65 @@
  105. +/* This program is free software; you can redistribute it and/or modify
  106. + * it under the terms of the GNU General Public License as published by
  107. + * the Free Software Foundation; either version 2, or (at your option)
  108. + * any later version.
  109. + *
  110. + * This program is distributed in the hope that it will be useful,
  111. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  112. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  113. + * GNU General Public License for more details.
  114. + *
  115. + * You should have received a copy of the GNU General Public License
  116. + * along with this program; if not, write to the Free Software
  117. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  118. + * 02111-1307, USA.
  119. + *
  120. + * http://www.gnu.org/copyleft/gpl.html
  121. + */
  122. +package net.l2jalpha.gameserver.model.entity;
  123. +
  124. +import java.util.concurrent.ScheduledFuture;
  125. +import java.util.logging.Logger;
  126. +
  127. +import javolution.util.FastMap;
  128. +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  129. +
  130. +/**
  131. + *
  132. + * @author Anarchy
  133. + */
  134. +public class LeaveBuster implements Runnable
  135. +{
  136. + public static FastMap<L2PcInstance, ScheduledFuture<?>> _players = new FastMap<>();
  137. +
  138. + private static final Logger _log = Logger.getLogger(LeaveBuster.class.getName());
  139. +
  140. + private L2PcInstance _p = null;
  141. +
  142. + public LeaveBuster(L2PcInstance p)
  143. + {
  144. + _p = p;
  145. + }
  146. +
  147. + @Override
  148. + public void run()
  149. + {
  150. + if (_p == null || !_p.isOnline())
  151. + {
  152. + if (_p != null)
  153. + {
  154. + _players.get(_p).cancel(true);
  155. + _players.remove(_p);
  156. + }
  157. +
  158. + return;
  159. + }
  160. +
  161. + if ((System.currentTimeMillis()-_p.getLastActionMillis())/1000/60 >= 30)
  162. + {
  163. + _log.info("Leave Buster: "+_p.getName()+" was kicked out of game.");
  164. + _players.get(_p).cancel(true);
  165. + _players.remove(_p);
  166. + _p.logout();
  167. + }
  168. + }
  169. +}
  170. Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java
  171. ===================================================================
  172. --- java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (revision 31)
  173. +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestRestart.java (working copy)
  174. @@ -22,6 +22,7 @@
  175. import net.l2jalpha.gameserver.communitybbs.Manager.RegionBBSManager;
  176. import net.l2jalpha.gameserver.datatables.xml.SkillTable;
  177. import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
  178. +import net.l2jalpha.gameserver.model.entity.LeaveBuster;
  179. import net.l2jalpha.gameserver.model.olympiad.OlympiadManager;
  180. import net.l2jalpha.gameserver.network.L2GameClient;
  181. import net.l2jalpha.gameserver.network.SystemMessageId;
  182. @@ -56,6 +57,8 @@
  183. _log.warning("[RequestRestart] activeChar null!?");
  184. return;
  185. }
  186. +
  187. + player.setLastActionMillis(System.currentTimeMillis());
  188.  
  189. if (player.isInOlympiadMode() || OlympiadManager.getInstance().isRegistered(player))
  190. {
  191. @@ -92,6 +95,9 @@
  192. {
  193. player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
  194. }
  195. +
  196. + LeaveBuster._players.get(player).cancel(true);;
  197. + LeaveBuster._players.remove(player);
  198.  
  199. L2GameClient client = getClient();
  200.  
  201. Index: java/net/l2jalpha/gameserver/network/clientpackets/MoveBackwardToLocation.java
  202. ===================================================================
  203. --- java/net/l2jalpha/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 31)
  204. +++ java/net/l2jalpha/gameserver/network/clientpackets/MoveBackwardToLocation.java (working copy)
  205. @@ -91,6 +91,8 @@
  206. L2PcInstance activeChar = getClient().getActiveChar();
  207. if (activeChar == null)
  208. return;
  209. +
  210. + activeChar.setLastActionMillis(System.currentTimeMillis());
  211.  
  212. _curX = activeChar.getX();
  213. _curY = activeChar.getY();
  214. Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestRestartPoint.java
  215. ===================================================================
  216. --- java/net/l2jalpha/gameserver/network/clientpackets/RequestRestartPoint.java (revision 31)
  217. +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestRestartPoint.java (working copy)
  218. @@ -160,6 +160,8 @@
  219.  
  220. if (activeChar == null)
  221. return;
  222. +
  223. + activeChar.setLastActionMillis(System.currentTimeMillis());
  224.  
  225. //SystemMessage sm2 = new SystemMessage(SystemMessage.S1_S2);
  226. //sm2.addString("type:"+requestedPointType);
  227. Index: java/net/l2jalpha/gameserver/network/clientpackets/RequestSocialAction.java
  228. ===================================================================
  229. --- java/net/l2jalpha/gameserver/network/clientpackets/RequestSocialAction.java (revision 31)
  230. +++ java/net/l2jalpha/gameserver/network/clientpackets/RequestSocialAction.java (working copy)
  231. @@ -49,6 +49,8 @@
  232. L2PcInstance activeChar = getClient().getActiveChar();
  233. if (activeChar == null)
  234. return;
  235. +
  236. + activeChar.setLastActionMillis(System.currentTimeMillis());
  237.  
  238. // check if its the actionId is allowed
  239. if (_actionId < 2 || _actionId > 13)
  240. Index: java/net/l2jalpha/gameserver/network/clientpackets/TradeRequest.java
  241. ===================================================================
  242. --- java/net/l2jalpha/gameserver/network/clientpackets/TradeRequest.java (revision 31)
  243. +++ java/net/l2jalpha/gameserver/network/clientpackets/TradeRequest.java (working copy)
  244. @@ -52,6 +52,8 @@
  245.  
  246. if (player == null)
  247. return;
  248. +
  249. + player.setLastActionMillis(System.currentTimeMillis());
  250.  
  251. if (!player.getAccessLevel().allowTransaction())
  252. {
  253. Index: java/net/l2jalpha/gameserver/network/clientpackets/UseItem.java
  254. ===================================================================
  255. --- java/net/l2jalpha/gameserver/network/clientpackets/UseItem.java (revision 31)
  256. +++ java/net/l2jalpha/gameserver/network/clientpackets/UseItem.java (working copy)
  257. @@ -63,6 +63,8 @@
  258.  
  259. if (activeChar == null)
  260. return;
  261. +
  262. + activeChar.setLastActionMillis(System.currentTimeMillis());
  263.  
  264. // Flood protect UseItem
  265. if (!getClient().getFloodProtectors().getUseItem().tryPerformAction("use item"))
Advertisement
Add Comment
Please, Sign In to add comment