src/main/java/de/dosmike/sponge/megamenus/EventListeners.java
@Listener
    public void onLookOrMoveEvent(MoveEntityEvent event) {
        if (event.getTargetEntity() instanceof Player) {
            Player p = (Player)event.getTargetEntity();
            RenderManager.getRenderFor(p).ifPresent(r->{
                if (r instanceof BookRenderer)
                    r.close(p);
            });
        }
    }
//check if book was closed and close the renderer
check if book was closed and close the renderer
check if book was closed and close the renderer
@Listener
    public void onLookOrMoveEvent(MoveEntityEvent event) {
        if (event.getTargetEntity() instanceof Player) {
            Player p = (Player)event.getTargetEntity();
            RenderManager.getRenderFor(p).ifPresent(r->{
                if (r instanceof BookRenderer)
                    r.close(p);
            });
        }
    }
@ Listener public void onLookOrMoveEvent ( MoveEntityEvent event ) { if ( event . getTargetEntity ( ) instanceof Player ) { Player p = ( Player ) event . getTargetEntity ( ) ; RenderManager . getRenderFor ( p ) . ifPresent ( r -> { if ( r instanceof BookRenderer ) r . close ( p ) ; } ) ; } }
check if book was closed and close the renderer
check if book was closed and close the renderer