Giardev

AFK CHECK + anti reward offline

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