[SPIGOT-2694] BlockBreakEvent is not cancel properly Created: 23/Sep/16  Updated: 10/Oct/16  Resolved: 10/Oct/16

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

Type: Bug Priority: Minor
Reporter: horyu1234 Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: 1.10, Spigot, bug
Environment:

all event listener setting, Java 8, Minecraft 1.10.2


Plugin: MyCustomPlugin

 Description   

here is my video https://youtu.be/ejPz-N3b-3U

and here is my code

public class BlockListener implements Listener {
    private ESIsland plugin;

    public BlockListener(ESIsland plugin) {
        this.plugin = plugin;
    }

    @EventHandler(priority = EventPriority.LOWEST)
    public void onBlockBreak(BlockBreakEvent event) {
        Location location = event.getBlock().getLocation();
        if (!location.getWorld().equals(Values.ISLAND_WORLD)) {
            return;
        }

        Island island = plugin.getIslandManager().getIsland(location);
        if (island == null) {
            event.setCancelled(true);
            event.getPlayer().sendMessage("§cIsland protected");
            return;
        }

        if (island.getValue(Island.Flag.ALLOW_BUILD).equals(Island.Value.PRIVATE)) {
            if (!event.getPlayer().getUniqueId().equals(island.getOwner().getUniqueId())) {
                event.setCancelled(true);
                event.getPlayer().sendMessage("§cIsland protected");
            }
        } else if (island.getValue(Island.Flag.ALLOW_BUILD).equals(Island.Value.FRIENDS)) {
            if (!(event.getPlayer().getUniqueId().equals(island.getOwner().getUniqueId()) /* || check friends */)) {
                event.setCancelled(true);
                event.getPlayer().sendMessage("§cIsland protected");
            }
        }
    }
}


 Comments   
Comment by Black Hole [ 24/Sep/16 ]

That is just a visual glitch for the client which tried to break the door. For the server and all other players the door is whole.
If the client reconnects the doors will be whole again for him, too.

It would be possible for Spigot to resend the other part of the door for the client this case. There might be similar issues with other blocks like beds.

Generated at Sun Mar 16 22:57:17 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.