mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 09:23:42 +01:00
Add hand used to BlockPlaceEvent.
This commit is contained in:
parent
45adbd9c6f
commit
8b69bdd0d1
1 changed files with 4 additions and 1 deletions
|
@ -132,13 +132,16 @@ public class CraftEventFactory {
|
||||||
boolean canBuild = canBuild(craftWorld, player, placedBlock.getX(), placedBlock.getZ());
|
boolean canBuild = canBuild(craftWorld, player, placedBlock.getX(), placedBlock.getZ());
|
||||||
|
|
||||||
org.bukkit.inventory.ItemStack item;
|
org.bukkit.inventory.ItemStack item;
|
||||||
|
EquipmentSlot equipmentSlot;
|
||||||
if (hand == EnumHand.MAIN_HAND) {
|
if (hand == EnumHand.MAIN_HAND) {
|
||||||
item = player.getInventory().getItemInMainHand();
|
item = player.getInventory().getItemInMainHand();
|
||||||
|
equipmentSlot = EquipmentSlot.HAND;
|
||||||
} else {
|
} else {
|
||||||
item = player.getInventory().getItemInOffHand();
|
item = player.getInventory().getItemInOffHand();
|
||||||
|
equipmentSlot = EquipmentSlot.OFF_HAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPlaceEvent event = new BlockPlaceEvent(placedBlock, replacedBlockState, blockClicked, item, player, canBuild);
|
BlockPlaceEvent event = new BlockPlaceEvent(placedBlock, replacedBlockState, blockClicked, item, player, canBuild, equipmentSlot);
|
||||||
craftServer.getPluginManager().callEvent(event);
|
craftServer.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
|
|
Loading…
Reference in a new issue