Error in console plugin

Discussion in 'Spigot Plugin Development' started by AvaterysPL, Sep 16, 2018 at 4:00 PM.

Thread Status:
Not open for further replies.
  1. xxxx
     
    #1 AvaterysPL, Sep 16, 2018 at 4:00 PM
    Last edited: Sep 16, 2018 at 6:12 PM
  2. From a quick search, apparently this error can be caused by setting the block a player is placing to air, as players cannot place air.
    I dunno why you check that the action is right click air so many times if you only need to do it once. If you use right_click_block, I'd guess that's most likely to be where the error is.

    Some other tips:
    - It's not good practice to hard-code color characters. Instead, use the org.bukkit.ChatColor enum
    - Method names should be written in lowerCamelCase. Only class names should be UpperCamelCase.
    - Before using e.getItem(), you should check that the item isn't null and its type isn't air. It'll only be one or the other, but I don't quite remember which in this case.
     
    #2 Escad, Sep 16, 2018 at 4:13 PM
    Last edited: Sep 16, 2018 at 4:24 PM
    • Like Like x 1
  3. i tried but I still can not do this
     
  4. Post the entire method/class into pastebin and link it here or use [ code ] [/code] brackets.
     
  5. yikes, readability.
    Anyways, try cancelling the event before you remove the item in their inventory. Also, you don't need that OfflinePlayer e. You can just remove it.
     
    • Winner Winner x 1
  6. Don't forget to mark as solved ^^.
     
Thread Status:
Not open for further replies.

Share This Page