mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 02:07:37 +01:00
SPIGOT-6714: Don't fire PlayerBucketEvent when empty
By: Noah van der Aa <ndvdaa@gmail.com>
This commit is contained in:
parent
3a23c54a91
commit
03aecfb428
@ -23,6 +23,7 @@
|
|||||||
IFluidSource ifluidsource = (IFluidSource) iblockdata.getBlock();
|
IFluidSource ifluidsource = (IFluidSource) iblockdata.getBlock();
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ ItemStack dummyFluid = ifluidsource.removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
|
+ ItemStack dummyFluid = ifluidsource.removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
|
||||||
|
+ if (dummyFluid.isEmpty()) return InteractionResultWrapper.fail(itemstack); // Don't fire event if the bucket won't be filled.
|
||||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem());
|
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem());
|
||||||
+
|
+
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user