Protect Item Frames

Discussion in 'Plugin Development' started by JSgr, Jul 20, 2014.

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

    JSgr

    Hi,

    How can I get the item in item frames ? If I can I want to protect it !

    Thanks for your answers.
     
  2. Offline

    Traks

    I don't quite understand what you want, but I assume blocking the removal of item frames and items in them is what you want. In that case, utilise HangingBreakByEntityEvent and EntityDamageByEntityEvent
     
  3. Offline

    JSgr

    I just want to protect the item who is in item frame.
     
  4. JSgr
    Maby you can do it whit PlayerInterachtEvent?
    When they right click a itemframe you cancel it (Rotate stuff)
    End left so they cant break it?
    I think you can do it whit that but i am nor 100% sure.
     
  5. Offline

    JSgr

    I have already do that, but this is protect item frame and only item frame not item in item frame, like this :

    Code:
    @EventHandler
    public void onDestroyByEntity(HangingBreakByEntityEvent event)
    {
    if(event.getRemover() instanceof Player)
            {
                if(event.getEntity().getType() == EntityType.ITEM_FRAME)
                        event.setCancelled(true);
            }
    }
    
     
  6. Offline

    JBoss925

    Well, your code doesn't work because you're checking if the item frame is breaking, not if they're removing the item within it. I know this plugin did it so it's possible. Let me try something in my IDE.
     
Thread Status:
Not open for further replies.

Share This Page