[1.6.4] Problem detecting if player has a custom mod item in inventory

Discussion in 'Plugin Development' started by DexArio, Apr 27, 2014.

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

    DexArio

    Hello everybody. I finished developping a custom mod and now I am doing a Bukkit plugin. The plugin basically searches for an item from my mod in all the players' inventories. If the item is found, it executes a command and deletes the item from the player's inventory. Here is my code:

    Code:java
    1. public void Check()
    2. {
    3. for(Player player : Bukkit.getServer().getOnlinePlayers())
    4. {
    5. Inventory i = player.getInventory();
    6.  
    7. for(ItemStack inven : i.getContents())
    8. {
    9. if(inven.getType().equals(10258))
    10. {
    11. Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pex group Pirate user add " + player.getName());
    12. i.remove(inven.getType());
    13. return;
    14. }
    15. if(inven.getType().equals(10259))
    16. {
    17. Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pex group Marin user add " + player.getName());
    18. i.remove(inven.getType());
    19. return;
    20. }
    21. }
    22. }
    23. }


    The problem is that it doesn't seem to detect the item so it doesn't delete it and execute the command. Also, to get the IDs, I pressed F3 + H and hovered my mouse over the items and it gave me their IDs (they are not the same that I have registered in my mod source code, I suppose Forge changed them). Thank you for your help.
     
  2. I may be wrong in saying so, but I believe that you might need BukkitForge or something along the lines of that name.
     
  3. Offline

    DexArio

    Shouldn't it work with the IDs ?
     
  4. DexArio 1. That's not how you'd check it.
    2. Third party builds aren't supported, so we can't help you I'm afraid.
     
  5. Offline

    epicfacecreeper

    It should be getType().getId() == (your id).

    Also, MCPC+.
     
  6. Offline

    TnT

    Locked. As you can see, writing plugins for a modded server is not the same as writing plugins for CraftBukkit. As such, we are not qualified to assist you. You should take your question to the people who make the mod you use.
     
Thread Status:
Not open for further replies.

Share This Page