How to get block before and after BlockPhysics event

Discussion in 'Plugin Development' started by TGF, Nov 17, 2012.

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

    TGF

    I have a problem. When I get the block at BlockPhysicsEvent i get weird data:p
    my code (open)
    Code:
    @EventHandler
        public void place(BlockPhysicsEvent event){
            Block b = event.getBlock();
            int type = 0;
            Material typee = b.getType();
            int data = b.getData();
            int x = b.getX();
            int y = b.getY();
            int z = b.getZ();
            this.logger.info("BlockPhysicsEvent");
            this.logger.info(type + "|X=" + x + "|Y=" + y +"|Z=" + z +"|Block type="+typee+":"+data);
            try {
                String query;
                sendQueryAlt(connection, query);
            } catch (Exception e) {
                this.logger.info("#e");
            }
    }

    part of serverlog (open)
    Code:
    19:56:46 [INFO] BlockPlaceEvent
    19:56:46 [INFO]|X=-813|Y=6|Z=106|Block type=SAND:0
    19:56:46 [INFO] BlockPhysicsEvent
    19:56:46 [INFO]|X=-813|Y=6|Z=105|Block type=BEDROCK:0
    19:56:46 [INFO] BlockPhysicsEvent
    19:56:46 [INFO]|X=-813|Y=6|Z=105|Block type=BEDROCK:0
    19:56:47 [INFO] BlockPhysicsEvent
    19:56:47 [INFO]|X=-813|Y=1|Z=106|Block type=BEDROCK:0
    19:56:47 [INFO] BlockPhysicsEvent
    19:56:47 [INFO]X=-813|Y=2|Z=105|Block type=BEDROCK:0

    First of all i would like to get just first block of Event and the last, to could now where the block have fell!
    screenshots connected with above log (open)
    [​IMG]
    [​IMG]


    And now, how we can see in the log plugin detect place event(ok) but i don't know why detect block next to on physic event ;)

    bump?:p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  2. Offline

    TGF

    Help :(
     
Thread Status:
Not open for further replies.

Share This Page