summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-11-18 09:27:46 +1100
committermd_5 <git@md-5.net>2018-11-18 09:27:46 +1100
commit1cac9d4fc1263efb19140b808ec8671d3e3bfc5e (patch)
tree2fdd75203b17f2a90e5eb6c8c1fe28f40f2925c0
parentb1d149cfd00b5715474feb304d1bbc8fdffa9bd1 (diff)
downloadcraftbukkit-1cac9d4fc1263efb19140b808ec8671d3e3bfc5e.tar
craftbukkit-1cac9d4fc1263efb19140b808ec8671d3e3bfc5e.tar.gz
craftbukkit-1cac9d4fc1263efb19140b808ec8671d3e3bfc5e.tar.lz
craftbukkit-1cac9d4fc1263efb19140b808ec8671d3e3bfc5e.tar.xz
craftbukkit-1cac9d4fc1263efb19140b808ec8671d3e3bfc5e.zip
Add Player to BlockCanBuildEvent
-rw-r--r--nms-patches/ItemBlock.patch5
1 files changed, 3 insertions, 2 deletions
diff --git a/nms-patches/ItemBlock.patch b/nms-patches/ItemBlock.patch
index b0bf1a67..ac90114c 100644
--- a/nms-patches/ItemBlock.patch
+++ b/nms-patches/ItemBlock.patch
@@ -21,15 +21,16 @@
itemstack.subtract(1);
return EnumInteractionResult.SUCCESS;
}
-@@ -64,7 +69,14 @@
+@@ -64,7 +69,15 @@
}
protected boolean b(BlockActionContext blockactioncontext, IBlockData iblockdata) {
- return iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition());
+ // CraftBukkit start - store default return
+ boolean defaultReturn = iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition());
++ org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null;
+
-+ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), CraftBlockData.fromData(iblockdata), defaultReturn);
++ BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn);
+ blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event);
+
+ return event.isBuildable();