Piston extension event

Discussion in 'Plugin Development' started by cdnyassuo34, Jul 27, 2019.

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

    cdnyassuo34

    (I am french so, my english can be bad ^u^)
    hi, I am making a claim plugin and I did claims unclaim etc ... but this is not the point.
    I would like to know if this is possible to detect a piston extension and get the position of the block that got moved and cancel it .
     
  2. Offline

    Machine Maker

  3. Offline

    cdnyassuo34

    I found the event but is it possible to detect the position of the block it pushed and get the player who placed the piston ?
     
  4. Offline

    Machine Maker

    So getting the position of the block it pushed is possible. The event has a getBlock method that returns the piston location and a getDirection() method that gets the direction it pushed. You should be able to get the block from that.

    As for getting the player that placed the piston, no, you can't get that directly from the event. What you can do, is create a list of all the pistons placed and who placed them.

    Then in the event you can check if the location is in that list and then get who placed that piston.

    What is this for? Maybe there is a better way to accomplish what you are trying to do.
     
  5. Offline

    cdnyassuo34

    it's for a claim plugin. I want to prevent from steal (piston can be used to steal diamonds block or something else)
     
Thread Status:
Not open for further replies.

Share This Page