Fixed a bug causing the player to be unable to fill buckets

This commit is contained in:
Ellpeck 2016-04-29 19:31:33 +02:00
parent 3cd7512ed6
commit e267d0110d

View file

@ -30,11 +30,13 @@ public class BucketFillEvent{
} }
private void fillBucket(FillBucketEvent event, Item item, Block fluid){ private void fillBucket(FillBucketEvent event, Item item, Block fluid){
Block block = PosUtil.getBlock(event.getTarget().getBlockPos(), event.getWorld()); if(event.getTarget() != null && event.getTarget().getBlockPos() != null){
if(block == fluid){ Block block = PosUtil.getBlock(event.getTarget().getBlockPos(), event.getWorld());
event.getWorld().setBlockToAir(event.getTarget().getBlockPos()); if(block == fluid){
event.setFilledBucket(new ItemStack(item)); event.getWorld().setBlockToAir(event.getTarget().getBlockPos());
event.setResult(Event.Result.ALLOW); event.setFilledBucket(new ItemStack(item));
event.setResult(Event.Result.ALLOW);
}
} }
} }
} }