1.8.8 Cancel map removing from itemframe

Discussion in 'Spigot Plugin Development' started by SrPattif, Jul 5, 2021.

  1. Hi.
    I'm using Frame Picture to draw a image in Item Frames, but when I Right Click the frame, it disappears.

    I'm using this events to try to cancel:

    Code (Text):
    @EventHandler(priority = EventPriority.HIGH)
        public void onHangingBreak(HangingBreakEvent e) {
            if (e.getEntity() instanceof ItemFrame) {
                e.setCancelled(true);
            }
        }

        @EventHandler
        public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
            if (!event.isCancelled() && event.getRightClicked() instanceof ItemFrame && !((ItemFrame) event.getRightClicked()).getItem().getType().equals(Material.AIR)) {
                event.setCancelled(true);
            }
        }
    Normal itens aren't removed from ItemFrame, but the FramePicture maps (I think it is made with maps) can be removed Right Clicking.
     
  2. Did you try with PlayerInteractEvent?
     
  3. Actually, if I right-click it, it looks like this:
    [​IMG]

    But if I go away from Frame and come back, it's back to normal.