mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
Update block interact event, and add some clarifying Javadocs on what blockItemUse method does (#102)
(cherry picked from commit dfe892aa1a
)
This commit is contained in:
parent
20bd56ebca
commit
6f6a54857e
@ -19,6 +19,7 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent
|
||||
private final Player.Hand hand;
|
||||
private final Block block;
|
||||
private final Point blockPosition;
|
||||
private final Point cursorPosition;
|
||||
private final BlockFace blockFace;
|
||||
|
||||
/**
|
||||
@ -36,6 +37,7 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent
|
||||
this.hand = hand;
|
||||
this.block = block;
|
||||
this.blockPosition = blockPosition;
|
||||
this.cursorPosition = cursorPosition;
|
||||
this.blockFace = blockFace;
|
||||
}
|
||||
|
||||
@ -49,9 +51,9 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the event should block the item use.
|
||||
*
|
||||
* @param blocks true if the item use should be blocked, false otherwise
|
||||
* Sets the blocking item use state of this event
|
||||
* Note: If this is true, then no {@link PlayerUseItemOnBlockEvent} will be fired.
|
||||
* @param blocks - true to block item interactions, false to not block
|
||||
*/
|
||||
public void setBlockingItemUse(boolean blocks) {
|
||||
this.blocksItemUse = blocks;
|
||||
@ -71,6 +73,12 @@ public class PlayerBlockInteractEvent implements PlayerInstanceEvent, BlockEvent
|
||||
return blockPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cursor position of the interacted block
|
||||
* @return the cursor position of the interaction
|
||||
*/
|
||||
public @NotNull Point getCursorPosition() { return cursorPosition; }
|
||||
|
||||
/**
|
||||
* Gets the hand used for the interaction.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user