-JRGames-

Sistema Ant PvP farming

Jan 4th, 2023
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: java/net/sf/l2j/Config.java
  2. ===================================================================
  3. --- java/net/sf/l2j/Config.java (revision 84)
  4. +++ java/net/sf/l2j/Config.java (working copy)
  5.  
  6. +   public static boolean ENABLE_FARM_PVP;
  7.  
  8. +   ENABLE_FARM_PVP = server.getProperty("PvPProtect", false);
  9.  
  10. ===================================================================
  11. --- java/net/sf/l2j/gameserver/model/actor/Player.java  (revision 0)
  12. +++ java/net/sf/l2j/gameserver/model/actor/Player.java  (working copy)
  13. @@ -0,0 +1,84 @@
  14.  
  15.  
  16.     public void onKillUpdatePvPKarma(Playable target)
  17.     {
  18.         if (target == null)
  19.             return;
  20.        
  21.         final Player targetPlayer = target.getActingPlayer();
  22.         if (targetPlayer == null || targetPlayer == this)
  23.             return;
  24.        
  25. +   if (Config.ENABLE_FARM_PVP)
  26. +       checkAntiFarm();
  27.            
  28.            
  29.  
  30.  
  31. +   public boolean checkAntiFarm()
  32. +   {
  33. +       for (Player target : World.getInstance().getPlayers())
  34. +       {
  35. +           if (getClient() != null && target.getClient() != null)
  36. +           {
  37. +               String ip1 = getClient().getConnection().getInetAddress().getHostAddress();
  38. +               String ip2 = target.getClient().getConnection().getInetAddress().getHostAddress();
  39. +              
  40. +               if (ip1.equals(ip2))
  41. +               {
  42. +                   LOGGER.warn("PvP Protection: " + getName() + " e " + target.getName() + ". mesmo IP.");
  43. +                   sendMessage(target.getName() + " é do seu mesmo IP, não sera contado o PvP. Isso poderar levar BAN!");
  44. +                   return false;
  45. +               }
  46. +           }
  47. +       }
  48. +       return true;
  49. +   }
  50.  
  51. +   # =================================================================
  52. +   #                  PvP Point  Protect IP
  53. +   # =================================================================
  54. +   # Protect for PvP, players same Ip not win PVP point.
  55. +   PvPProtect = False
Add Comment
Please, Sign In to add comment