Arrow Cap off

Discussion in 'Plugin Development' started by TCO_007, Jun 9, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    TCO_007

    Hello! I am trying to create a method whereas every minute the player with the Atlatl kit selected is given 1 arrow and it caps off at 10, meaning once it hits 10, the player cant receive anymore. So far, this is all I have been able to figure out though....
    Code:java
    1. Inventory Pinv = player.getInventory();
    2. ItemStack Arrow = new ItemStack(Material.ARROW);
    3. for (ItemStack item : Pinv.getContents()){
    4. if (item == null){
    5. continue;
    6. }
    7. if (item.getType().equals(Material.ARROW)){
    8.  
    9. }
    10.  
    11. }
    12. }
    13.  
    14. }
    15. }

    Can anyone explain to me how to check for all that stuff? Thanks!
     
  2. Offline

    THEREDBARON24

    If there is only one player, then use an int and add one to it each time. If there are multiple people with the same kit, then use a hashmap with args player and integer. on Give or whatever you call it, if the number (for the player if its a hashmap) is == 10, then deny, else allow. The minute timer can be accomplished with the Bukkit scheduler, however, this can be tricky to understand at first. Is there only one instance of this happening at any given time? I can assist here as well, however, I need to know more about how this situation is occurring.
     
Thread Status:
Not open for further replies.

Share This Page