Solved Placing block detection

Discussion in 'Plugin Development' started by Aragone, Jul 1, 2019.

  1. Offline

    Aragone

  2. Offline

    KarimAKL

    @Aragone Instead of comparing the item using '==', you should use 'ItemStack#isSimilar(ItemStack)'.
     
  3. Offline

    Aragone

    This is fixing an other bug (it was returning "nop" twice) but it doesn't fix the problem
     
  4. Offline

    KarimAKL

    @Aragone Try using 'e.getItemInHand().isSimilar(TrocPlugin.chest1)'.
     
  5. Offline

    Kars

    Or
    PHP:
    item.getType() == Material.CHEST
     
  6. Offline

    KarimAKL

    @Kars That would only check the material, if it's a custom item they have, then i think equals() or isSimilar() is needed.
    EDIT: I added a comma ( , ) so my post made more sense.
     
    Last edited: Jul 1, 2019
    Kars likes this.
  7. Offline

    Aragone

    It doesn't work too... That's very strange
     
  8. Online

    timtower Ninja on the waves Moderator

    Please post your updated code.
     
  9. Offline

    Aragone

  10. Online

    timtower Ninja on the waves Moderator

  11. Offline

    Aragone

    @timtower There is nothing here because all of the issues of this thread don't run
     
  12. Online

    timtower Ninja on the waves Moderator

    Then make something that compiles and where you think that it should work.
    Don't post code that doesn't compile.
     

Share This Page