How to make item frames unbreakable?

Discussion in 'Spigot Plugin Development' started by GoNelson, Jun 13, 2017.

  1. Hello good peeps of spigot!

    just wondering as the title says
    how i would go about making
    item frames unbreakable?

    What i have so far:
    Code (Text):
        public void onBlockBreak(BlockBreakEvent e) {      
            Block block = e.getBlock();
            if(block.getType() == Material.ITEM_FRAME);
  2. ScarabCoder

    ScarabCoder Retired Resource Staff

    Item frames aren't blocks, they're entities. You want to listen for the EntityDamageEvent.
  3. Item frames are special and have their own classes and package in spigot, even though they are entities. Check out the HangingBreakEvent and cancel it.
    • Agree Agree x 1
    • Informative Informative x 1
  4. Bro, i cant beleive i didnt think of that. Im stupid, Thanks so much for the help!
  5. I know you're asking for how to code it, but i use lwc, and i replaced it with lwc entity locking plugin, that supports locking banners, paintings item frames and all that. i do not know if they have a git hub, but if so, you can draw example from it