[SPIGOT-4192] Water source is still removed after BlockDispenseEvent is canceled Created: 30/Jul/18  Updated: 30/Jul/18  Resolved: 30/Jul/18

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Justin Lawen Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: BlockDispenseEvent, bucket, dispenser, water

Attachments: Java Archive File QuickTest.jar    
Version: This server is running CraftBukkit version git-Spigot-69774b3-8592585 (MC: 1.13) (Implementing API version 1.13-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

When a BlockDispenseEvent involving a dispenser and an empty bucket is canceled, water sources are still removed.

Steps:

  1. Run a server with the included plugin enabled
  2. Place a dispenser facing into a lone water source block
  3. Put an empty bucket in the dispenser
  4. Activate the dispenser with a redstone pulse
  5. Check console output and water source

Expected: There should be a message in the console indicating the BlockDispenseEvent was fired and canceled, there should be an untouched water source block in front of the dispenser, and the bucket item should be empty, as before.

Actual: While the bucket is unmodified as expected, the water source block has been removed.

Notes: This only appears to be an issue with the empty bucket; specifically, events involving water buckets, flint & steel, and bonemeal were tested and work as expected. Dispenser orientation and location do not seem to make any difference. Tested on a newly installed Spigot server with only the included plugin enabled.

Minimal Reproduction Plugin:

package com.lesserhydra.quicktest;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDispenseEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class QuickTest extends JavaPlugin implements Listener {
  
  @Override
  public void onEnable() {
    getServer().getPluginManager().registerEvents(this, this);
  }
  
  @EventHandler
  private void onBlockDispense(BlockDispenseEvent event) {
    event.setCancelled(true);
    getLogger().info("canceled event: " + event.getBlock().getType().name()
                     + " dispense " + event.getItem().getType());
  }
  
}

 

Bug reports which do not 1) contain a declaration of testing in Vanilla and without plugins, or 2) in the case of plugin API bugs, contain a minimal reproduction case (source + jar please) will be closed. Bug reports must contain step by step instructions to reproduce the bug from a clean server install with no assumptions or prior knowledge. Also make sure you include the full output of /version in your report. Please copy and paste this statement to the bottom of your report to indicate that you have read and understood it.


 Comments   
Comment by md_5 [ 30/Jul/18 ]

And 1.12.2?

Generated at Tue Apr 08 03:01:11 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.