Solved Item Frame Help

Discussion in 'Plugin Development' started by JPG2000, Apr 12, 2015.

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



    I would like help in stopping a player from removing an item from an item frame. I catch the EntityDamageByEntityEvent, and can't figure out how to determine if the entity (event.getEntity()) is inside an item frame.

    By canceling this event out right it works fine, but this cancels any entity from being damaged. Also I cancel the HangingBreakEvent, though that just stops the actual frame from being broken.

    Help would be appreciated. Thanks!
  2. Offline


    Well, I suppose you could just get the Item#getNearbyEntities() contents, and see if it contains an instance of an item frame. That's all I can think of.
  3. Offline


    I'm just very confuzzeled. Would the victum (the "event.getEntity()") be an actual entity of the item, or an ItemFrame? I don't know what to check for.

    I figured it out! All I had to do was check if the entity was an ItemFrame, then cancel from there.

    Last edited by a moderator: Apr 14, 2015
    ColonelHedgehog likes this.
  4. Offline


    Don't forget to mark this as solved :p
Thread Status:
Not open for further replies.

Share This Page