onBlockPlaced before Player_Interact

Discussion in 'Plugin Development' started by SycoPrime, Apr 10, 2011.

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

    SycoPrime

    Hello. I work on MoveCraft, and I'm trying to solve an issue.

    When Player_Interact replaced everything, onBlockPlace wound up firing after it. However, I have a catch in onBlockPlace that allows players to place blocks on craft without moving the craft, and this change made me sad.
    I have to figure out a way to check in Player_Interact whether or not a player placed a block, in order to know whether or not the right-click action should be taken as anything but a block place, because if they did place a block, I want to ignore that particular event.

    Does anyone have any suggestions?

    Thank you.
     
  2. Offline

    SycoPrime

  3. Offline

    nisovin

    Can't you just do something like:

    if (event.hasBlock() || event.hasItem()) {
    return;
    }

    This may be too simple, you may also want to check the player's item in hand to see if it should be allowed anyway.
     
    SycoPrime likes this.
  4. Offline

    SycoPrime

    From the look of things, that accomplished what I needed to. Thank you!
     
Thread Status:
Not open for further replies.

Share This Page