Advertisement
vampir

Flood protection

Apr 9th, 2011
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.72 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Server
  3. Index: java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java
  4. ===================================================================
  5. --- java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java (revision 4524)
  6. +++ java/com/l2jserver/gameserver/network/clientpackets/MoveBackwardToLocation.java (working copy)
  7. @@ -18,6 +18,7 @@
  8.  
  9.  import com.l2jserver.Config;
  10.  import com.l2jserver.gameserver.TaskPriority;
  11. +import com.l2jserver.gameserver.ThreadPoolManager;
  12.  import com.l2jserver.gameserver.ai.CtrlIntention;
  13.  import com.l2jserver.gameserver.model.L2CharPosition;
  14.  import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  15. @@ -114,10 +113,13 @@
  16.        
  17.         if (_moveMovement == 0 && Config.GEODATA < 1) // cursor movement without geodata is disabled
  18.         {
  19. +
  20.             activeChar.sendPacket(ActionFailed.STATIC_PACKET);
  21.         }
  22.         else
  23.         {
  24. +           if(activeChar.canMove()){
  25. +
  26.             double dx = _targetX - _curX;
  27.             double dy = _targetY - _curY;
  28.             // Can't move if character is confused, or trying to move a huge distance
  29. @@ -130,9 +132,28 @@
  30.            
  31.             /*if (activeChar.getParty() != null)
  32.                 activeChar.getParty().broadcastToPartyMembers(activeChar, new PartyMemberPosition(activeChar));*/
  33. +          
  34. +           activeChar.setCanMove(false);
  35. +           ThreadPoolManager.getInstance().scheduleGeneral(new protection(activeChar), 1000);//1 sec
  36. +           }else{
  37. +               activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(activeChar.getX()+1, activeChar.getY()+1, activeChar.getZ()+1, 0));
  38. +               activeChar.sendMessage("You were clicking too fast.");
  39. +           }
  40.         }
  41.     }
  42.    
  43. +   class protection implements Runnable
  44. +   {
  45. +       L2PcInstance activeChar;
  46. +       public protection(L2PcInstance player){
  47. +           activeChar = player;
  48. +       }
  49. +       @Override
  50. +       public void run()
  51. +       {
  52. +           activeChar.setCanMove(true);
  53. +       }
  54. +   }
  55.     /* (non-Javadoc)
  56.      * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
  57.      */
  58. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  59. ===================================================================
  60. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 4544)
  61. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  62. @@ -494,6 +494,7 @@
  63.     private int _olympiadGameId = -1;
  64.     private int _olympiadSide = -1;
  65.     public int olyBuff = 0;
  66. +   private boolean _movementAllowed = true;
  67.    
  68.     /** Duel */
  69.     private boolean _isInDuel = false;
  70. @@ -15083,4 +15084,11 @@
  71.         // Maintain = 1
  72.         return 0;
  73.     }
  74. +
  75. +   public void setCanMove(boolean x){
  76. +       _movementAllowed = x;
  77. +   }
  78. +   public boolean canMove(){
  79. +       return _movementAllowed;
  80. +   }
  81.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement