Advertisement
scraw

anti AFK per time Frozen

Feb 19th, 2021
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.88 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2jFrozen_GameServer
  3. Index: head-src / com / l2jfrozen / Config.java
  4. ================================================== =================
  5. --- head-src / com / l2jfrozen / Config.java (revision 1004)
  6. +++ head-src / com / l2jfrozen / Config.java (working copy)
  7. @@ -3418.6 +3418.9 @@
  8. public static int ALLOWED_BOXES;
  9. public static boolean ALLOW_DUALBOX_OLY;
  10. public static boolean ALLOW_DUALBOX_EVENT;
  11. +
  12. + public static int LEAVEBURSTER_TIME_KICK;
  13. +
  14. // ================================================ ============
  15. public static void loadPOtherConfig ()
  16. {
  17. @@ -3453.6 +3456.8 @@
  18. BOT_PROTECTOR_FIRST_CHECK = Integer.parseInt (POtherSetting.getProperty ("BotProtectFirstCheck", "15"));
  19. BOT_PROTECTOR_NEXT_CHECK = Integer.parseInt (POtherSetting.getProperty ("BotProtectNextCheck", "60"));
  20. BOT_PROTECTOR_WAIT_ANSVER = Integer.parseInt (POtherSetting.getProperty ("BotProtectAnsver", "180"));
  21. +
  22. + LEAVEBURSTER_TIME_KICK = Integer.parseInt (POtherSetting.getProperty ("LeaveBursterTimeKick", "10"));
  23. }
  24. catch (Exception e)
  25. {
  26. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestRestartPoint.java
  27. ================================================== =================
  28. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestRestartPoint.java (revision 1004)
  29. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestRestartPoint.java (working copy)
  30. @@ -230.6 +230.8 @@
  31. if (activeChar == null)
  32. return;
  33.  
  34. + activeChar.setLastActionMillis (System.currentTimeMillis ());
  35. +
  36. if (activeChar.isFakeDeath ())
  37. {
  38. activeChar.stopFakeDeath (null);
  39. Index: head-src / com / l2jfrozen / gameserver / model / entity / LeaveBuster.java
  40. ================================================== =================
  41. --- head-src / com / l2jfrozen / gameserver / model / entity / LeaveBuster.java (revision 0)
  42. +++ head-src / com / l2jfrozen / gameserver / model / entity / LeaveBuster.java (working copy)
  43. @@ -0.0 +1.66 @@
  44. + / * This program is free software; you can redistribute it and / or modify
  45. + * it under the terms of the GNU General Public License as published by
  46. + * the Free Software Foundation; either version 2, or (at your option)
  47. + * any later version.
  48. + *
  49. + * This program is distributed in the hope that it will be useful,
  50. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  51. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  52. + * GNU General Public License for more details.
  53. + *
  54. + * You should have received a copy of the GNU General Public License
  55. + * along with this program; if not, write to the Free Software
  56. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  57. + * 02111-1307, USA.
  58. + *
  59. + * http://www.gnu.org/copyleft/gpl.html
  60. + * /
  61. + package com.l2jfrozen.gameserver.model.entity;
  62. +
  63. + import java.util.concurrent.ScheduledFuture;
  64. + import java.util.logging.Logger;
  65. +
  66. + import javolution.util.FastMap;
  67. +
  68. + import com.l2jfrozen.Config;
  69. + import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  70. +
  71. + / **
  72. + *
  73. + * /
  74. + public class LeaveBuster implements Runnable
  75. + {
  76. + public static FastMap <L2PcInstance, ScheduledFuture <? >> _players = new FastMap <L2PcInstance, ScheduledFuture <? >> ();
  77. +
  78. + private static final Logger _log = Logger.getLogger (LeaveBuster.class.getName ());
  79. +
  80. + private L2PcInstance _p = null;
  81. +
  82. + public LeaveBuster (L2PcInstance p)
  83. + {
  84. + _p = p;
  85. +}
  86. +
  87. + @Override
  88. + public void run ()
  89. + {
  90. + if (_p == null || _p.isOnline () == 0)
  91. + {
  92. + if (_p! = null)
  93. + {
  94. + _players.get (_p) .cancel (true);
  95. + _players.remove (_p);
  96. +}
  97. +
  98. + return;
  99. +}
  100. +
  101. + if ((System.currentTimeMillis () - _p.getLastActionMillis ()) / 1000/60> = Config.LEAVEBURSTER_TIME_KICK)
  102. + {
  103. + _log.info ("Leave Buster:" + _p.getName () + "was kicked out of game.");
  104. + _players.get (_p) .cancel (true);
  105. + _players.remove (_p);
  106. + _p.logout ();
  107. +}
  108. +}
  109. +}
  110. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / Say2.java
  111. ================================================== =================
  112. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / Say2.java (revision 1004)
  113. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / Say2.java (working copy)
  114. @@ -170.6 +170.8 @@
  115. _type = PETITION_GM;
  116. }
  117.  
  118. + activeChar.setLastActionMillis (System.currentTimeMillis ());
  119. +
  120. if (_text.length ()> Config.MAX_CHAT_LENGTH)
  121. {
  122. if (Config.DEBUG)
  123. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestRestart.java
  124. ================================================== =================
  125. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestRestart.java (revision 1004)
  126. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestRestart.java (working copy)
  127. @@ -27.6 +27.7 @@
  128. import com.l2jfrozen.gameserver.model.Inventory;
  129. import com.l2jfrozen.gameserver.model.L2Party;
  130. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  131. + import com.l2jfrozen.gameserver.model.entity.LeaveBuster;
  132. import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
  133. import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSignsFestival;
  134. import com.l2jfrozen.gameserver.network.L2GameClient;
  135. @@ -60.6 +61.8 @@
  136. return;
  137. }
  138.  
  139. + player.setLastActionMillis (System.currentTimeMillis ());
  140. +
  141. // Check if player is enchanting
  142. if (player.getActiveEnchantItem ()! = null)
  143. {
  144. @@ -165.6 +168.9 @@
  145. {
  146. player.removeSkill (SkillTable.getInstance (). getInfo (4289, 1));
  147. }
  148. +
  149. + LeaveBuster._players.get (player) .cancel (true);
  150. + LeaveBuster._players.remove (player);
  151.  
  152. if (player.getInventory (). getPaperdollItem (Inventory.PAPERDOLL_RHAND)! = null
  153. && player.getInventory (). getPaperdollItem (Inventory.PAPERDOLL_RHAND) .isAugmented ()) {
  154. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / TradeRequest.java
  155. ================================================== =================
  156. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / TradeRequest.java (revision 1004)
  157. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / TradeRequest.java (working copy)
  158. @@ -49.7 +49.9 @@
  159. if (player == null)
  160. return;
  161.  
  162. - if (! player.getAccessLevel (). allowTransaction ())
  163. + player.setLastActionMillis (System.currentTimeMillis ());
  164. +
  165. + if (! player.getAccessLevel (). allowTransaction ())
  166. {
  167. player.sendMessage ("Transactions are disable for your Access Level");
  168. player.sendPacket (ActionFailed.STATIC_PACKET);
  169. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / MoveBackwardToLocation.java
  170. ================================================== =================
  171. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / MoveBackwardToLocation.java (revision 1004)
  172. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / MoveBackwardToLocation.java (working copy)
  173. @@ -76.6 +76.8 @@
  174. if (activeChar == null)
  175. return;
  176.  
  177. + activeChar.setLastActionMillis (System.currentTimeMillis ());
  178. +
  179. // Move flood protection
  180. if (! getClient (). getFloodProtectors (). getMoveAction (). tryPerformAction ("MoveBackwardToLocation"))
  181. {
  182. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / Logout.java
  183. ================================================== =================
  184. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / Logout.java (revision 1004)
  185. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / Logout.java (working copy)
  186. @@ -22.6 +22.7 @@
  187. import com.l2jfrozen.gameserver.model.L2Character;
  188. import com.l2jfrozen.gameserver.model.L2Party;
  189. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  190. + import com.l2jfrozen.gameserver.model.entity.LeaveBuster;
  191. import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
  192. import com.l2jfrozen.gameserver.model.entity.sevensigns.SevenSignsFestival;
  193. import com.l2jfrozen.gameserver.network.SystemMessageId;
  194. @@ -47.6 +48.8 @@
  195. if (player == null)
  196. return;
  197.  
  198. + player.setLastActionMillis (System.currentTimeMillis ());
  199. +
  200. if (player.isInFunEvent () &&! player.isGM ())
  201. {
  202. player.sendMessage ("You cannot Logout while registered in an Event.");
  203. @@ -118.6 +121.9 @@
  204. if (player.isFlying ())
  205. player.removeSkill (SkillTable.getInstance (). getInfo (4289, 1));
  206.  
  207. + LeaveBuster._players.get (player) .cancel (true);
  208. + LeaveBuster._players.remove (player);
  209. +
  210. if (Config.OFFLINE_LOGOUT && player.isSitting ())
  211. {
  212. if ((player.isInStoreMode () && Config.OFFLINE_TRADE_ENABLE) || (player.isInCraftMode () && Config.OFFLINE_CRAFT_ENABLE))
  213. Index: config / protected / other.properties
  214. ================================================== =================
  215. --- config / protected / other.properties (revision 1004)
  216. +++ config / protected / other.properties (working copy)
  217. @@ -60.4 +60.7 @@
  218. # The time interval, which will take place from the previous question until the next (minutes).
  219. BotProtectNextCheck = 60
  220. # Amount of time allowed for giving the answer (seconds).
  221. BotProtectAnsver = 200
  222. +
  223. + # Time to kick afkers. Default = 0 (Disabled)
  224. + LeaveBursterTimeKick = 10
  225. \ No newline at end of file
  226. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / UseItem.java
  227. ================================================== =================
  228. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / UseItem.java (revision 1004)
  229. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / UseItem.java (working copy)
  230. @@ -64.6 +64.8 @@
  231. if (activeChar == null)
  232. return;
  233.  
  234. + activeChar.setLastActionMillis (System.currentTimeMillis ());
  235. +
  236. L2ItemInstance item = activeChar.getInventory (). GetItemByObjectId (_objectId);
  237.  
  238. if (item == null)
  239. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / EnterWorld.java
  240. ================================================== =================
  241. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / EnterWorld.java (revision 1004)
  242. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / EnterWorld.java (working copy)
  243. @@ -56.6 +56.7 @@
  244. import com.l2jfrozen.gameserver.model.entity.Announcements;
  245. import com.l2jfrozen.gameserver.model.entity.ClanHall;
  246. import com.l2jfrozen.gameserver.model.entity.Hero;
  247. + import com.l2jfrozen.gameserver.model.entity.LeaveBuster;
  248. import com.l2jfrozen.gameserver.model.entity.Wedding;
  249. import com.l2jfrozen.gameserver.model.entity.event.CTF;
  250. import com.l2jfrozen.gameserver.model.entity.event.DM;
  251. @@ -133.6 +134.9 @@
  252. // Set lock at login
  253. activeChar.setLocked (true);
  254.  
  255. + activeChar.setLastActionMillis (System.currentTimeMillis ());
  256. + LeaveBuster._players.put (activeChar, ThreadPoolManager.getInstance (). ScheduleGeneralAtFixedRate (new LeaveBuster (activeChar), 5000, 5000));
  257. +
  258. // Register in flood protector
  259. //FloodProtector.getInstance (). RegisterNewPlayer (activeChar.getObjectId ());
  260.  
  261. Index: head-src / com / l2jfrozen / gameserver / model / actor / instance / L2PcInstance.java
  262. ================================================== =================
  263. --- head-src / com / l2jfrozen / gameserver / model / actor / instance / L2PcInstance.java (revision 1004)
  264. +++ head-src / com / l2jfrozen / gameserver / model / actor / instance / L2PcInstance.java (working copy)
  265. @@ -455.6 +455.8 @@
  266. / ** The active_boxes_characters. * /
  267. public List <String> active_boxes_characters = new ArrayList <String> ();
  268.  
  269. + private long _lastAction = 0;
  270. +
  271. / ** UPDATE characters SET level = ?, maxHp = ?, curHp = ?, maxCp = ?, curCp = ?, maxMp = ?, curMp = ?, str = ?, con = ?, dex =?, _ Int = ?, men = ?, wit =? , face = ?, hairStyle = ?, hairColor = ?, heading = ?, x = ?, y = ?, z = ?, exp = ?, expBeforeDeath = ?, sp = ?, karma = ?, pvpkills = ?, pkkills = ?, rec_have = ?, rec_left = ?, clanid = ?, maxload = ?, race = ?, classid = ?, deletetime = ?, title = ?, accesslevel = ?, online = ?, isin7sdungeon = ?, clan_privs =? , wantspeace = ?, base_class = ?, onlinetime = ?, in_jail = ?, jail_timer = ?, newbie = ?, nobless = ?, power_grade = ?, subpledge = ?, last_recom_date = ?, lvl_joined_academy = ?, apprentice = ?, sponsorice = ?, varka_ketra_ally = ?, clan_join_expiry_time = ?, clan_create_expiry_time =? , char_name = ?, death_penalty_level = ?, good = ?, evil = ?, gve_kills =? WHERE obj_id = ?. * /
  272. private static final String UPDATE_CHARACTER = "UPDATE characters SET level = ?, maxHp = ?, curHp = ?, maxCp = ?, curCp = ?, maxMp =?, curMp = ?, str = ?, con = ?, dex = ?, _int = ?, men = ?, wit = ?, face = ?, hairStyle = ?, hairColor = ?, heading = ?, x = ?, y = ?, z = ?, exp = ?, expBeforeDeath = ?, sp = ?, karma = ?, pvpkills = ?, pkkills = ?, rec_have = ?, rec_left = ?, clanid = ?, maxload = ?, race = ?, classid = ?, deletetime = ?, title = ?, accesslevel = ?, online = ?, isin7sdungeon = ?, clan_privs = ?, wantspeace = ?, base_class = ?, onlinetime = ?, punish_level = ?, punish_timer = ?, newbie = ?, nobless = ?, power_grade = ?, subpledge = ?, last_recom_date = ?, lvl_joined_academy = ?, apprentice = ?, sponsor = ?, varka_ketra_ally = ?, clan_join_expiry_time = ?, clan_create_expiry_time = ?, char_name = ?, death_penalty_level = ?, pc_point = ?, name_color = ?, title_color = ?, title_color = ?, title_color = ?, title_color = ?, title_color =? aio_end =? WHERE obj_id =? ";
  273.  
  274. @@ -19299.6 +19301,16 @@
  275. }
  276. * /
  277. }
  278. +
  279. + public long getLastActionMillis ()
  280. + {
  281. + return _lastAction;
  282. +}
  283. +
  284. + public void setLastActionMillis (long val)
  285. + {
  286. + _lastAction = val;
  287. +}
  288.  
  289. / **
  290. * Aio System Start.
  291. @@ -20376.5 +20388.4 @@
  292.  
  293. _currentPetSkill = new SkillDat (currentSkill, ctrlPressed, shiftPressed);
  294. }
  295. -
  296. }
  297. \ No newline at end of file
  298. Index: head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestSocialAction.java
  299. ================================================== =================
  300. --- head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestSocialAction.java (revision 1004)
  301. +++ head-src / com / l2jfrozen / gameserver / network / clientpackets / RequestSocialAction.java (working copy)
  302. @@ -45.6 +45.8 @@
  303. L2PcInstance activeChar = getClient (). GetActiveChar ();
  304. if (activeChar == null)
  305. return;
  306. +
  307. + activeChar.setLastActionMillis (System.currentTimeMillis ());
  308.  
  309. // You cannot do anything else while fishing
  310. if (activeChar.isFishing ())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement