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"); } } } }