Advertisement
Sarada-L2

AFK Check Players Frozen Yo: Sarada

Feb 18th, 2021
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.23 KB | None | 0 0
  1. diff --git a/head-src/com/l2jfrozen/Config.java b/head-src/com/l2jfrozen/Config.java
  2. index e41a7fe..166a404 100644
  3. --- a/head-src/com/l2jfrozen/Config.java
  4. +++ b/head-src/com/l2jfrozen/Config.java
  5. @@ -189,7 +189,7 @@
  6. public static int KNOWNLIST_FORGET_DELAY;
  7. public static int MINIMUN_UPDATE_TIME;
  8. public static boolean BYPASS_VALIDATION;
  9. -
  10. + public static int AFK_TIMER;
  11. public static boolean HIGH_RATE_SERVER_DROPS;
  12.  
  13. public static boolean FORCE_COMPLETE_STATUS_UPDATE;
  14. @@ -586,7 +586,7 @@
  15. final InputStream is = new FileInputStream(new File(OTHER));
  16. otherSettings.load(is);
  17. is.close();
  18. -
  19. + AFK_TIMER = Integer.parseInt(otherSettings.getProperty("TimerAFK", "10"));
  20. DEEPBLUE_DROP_RULES = Boolean.parseBoolean(otherSettings.getProperty("UseDeepBlueDropRules", "True"));
  21. ALLOW_GUARDS = Boolean.valueOf(otherSettings.getProperty("AllowGuards", "False"));
  22. EFFECT_CANCELING = Boolean.valueOf(otherSettings.getProperty("CancelLesserEffect", "True"));
  23. diff --git a/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCreateItem.java b/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCreateItem.java
  24. index 60012d1..f7eb345 100644
  25. --- a/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCreateItem.java
  26. +++ b/head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminCreateItem.java
  27. @@ -357,7 +357,7 @@
  28. activeChar.setTarget(activeChar);
  29. Player = activeChar;
  30. }
  31. -
  32. + if (!activeChar.isAFK())
  33. Player.getInventory().addItem("Admin", id, num, Player, null);
  34. ItemList il = new ItemList(Player, true);
  35. Player.sendPacket(il);
  36. diff --git a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  37. index b60fcda..a281692 100644
  38. --- a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  39. +++ b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
  40. @@ -19615,7 +19615,16 @@
  41. {
  42. return _currentPetSkill;
  43. }
  44. -
  45. + private long _lastAction;
  46. + public boolean isAFK()
  47. + {
  48. + return _lastAction < System.currentTimeMillis();
  49. + }
  50. +
  51. + public void updateLastAction()
  52. + {
  53. + _lastAction = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(Config.AFK_TIMER);
  54. + }
  55. /**
  56. * Create a new SkillDat object and set the player _currentPetSkill.<br>
  57. * <br>
  58. diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java
  59. index 2bbba88..576d2e5 100644
  60. --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java
  61. +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/MoveBackwardToLocation.java
  62. @@ -77,7 +77,7 @@
  63.  
  64. if (activeChar == null)
  65. return;
  66. -
  67. + activeChar.updateLastAction();
  68. // Move flood protection
  69. if (!getClient().getFloodProtectors().getMoveAction().tryPerformAction("MoveBackwardToLocation"))
  70. {
  71. diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestartPoint.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestartPoint.java
  72. index 63ffb78..4098ef8 100644
  73. --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestartPoint.java
  74. +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestRestartPoint.java
  75. @@ -231,7 +231,7 @@
  76.  
  77. if (activeChar == null)
  78. return;
  79. -
  80. + activeChar.updateLastAction();
  81. if (activeChar.isFakeDeath())
  82. {
  83. activeChar.stopFakeDeath(null);
  84. diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSocialAction.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSocialAction.java
  85. index 3a43371..d91045e 100644
  86. --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSocialAction.java
  87. +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSocialAction.java
  88. @@ -47,7 +47,7 @@
  89. final L2PcInstance activeChar = getClient().getActiveChar();
  90. if (activeChar == null)
  91. return;
  92. -
  93. + activeChar.updateLastAction();
  94. // You cannot do anything else while fishing
  95. if (activeChar.isFishing())
  96. {
  97. diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/Say2.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/Say2.java
  98. index 9a1d21a..b7c615c 100644
  99. --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/Say2.java
  100. +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/Say2.java
  101. @@ -142,7 +142,7 @@
  102. LOGGER.warn("[Say2.java] Active Character is null.");
  103. return;
  104. }
  105. -
  106. + activeChar.updateLastAction();
  107. if (activeChar.isChatBanned() && !activeChar.isGM() && _type != CLAN && _type != ALLIANCE && _type != PARTY)
  108. {
  109. activeChar.sendMessage("You may not chat while a chat ban is in effect.");
  110. diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java
  111. index e988860..dacfb3c 100644
  112. --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java
  113. +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java
  114. @@ -50,7 +50,7 @@
  115. final L2PcInstance player = getClient().getActiveChar();
  116. if (player == null)
  117. return;
  118. -
  119. + player.updateLastAction();
  120. if (!player.getAccessLevel().allowTransaction())
  121. {
  122. player.sendMessage("Transactions are disable for your Access Level");
  123. diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/UseItem.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/UseItem.java
  124. index 4d3b028..ee40555 100644
  125. --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/UseItem.java
  126. +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/UseItem.java
  127. @@ -66,7 +66,7 @@
  128. final L2PcInstance activeChar = getClient().getActiveChar();
  129. if (activeChar == null)
  130. return;
  131. -
  132. + activeChar.updateLastAction();
  133. final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
  134.  
  135. if (item == null)
  136.  
  137.  
  138. Index: DataPack
  139.  
  140. # Crit announce
  141. GMShowCritAnnouncerName = False
  142.  
  143. +# Each X minutes the server will count the player as AFK when he don't act.
  144. +TimerAFK = 10
  145.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement