#fixed code
                                @EventHandler
    public void onExplode(EntityExplodeEvent event) {
        List<Block> destroyed = event.blockList();
        Location loc = event.getLocation();
        Settings s = Settings.getInstance();

        List<Location> sphere = SpaceUtils.sphere(loc, s.explodeRadius, s.explodeRadius, false, true, 0);
        Map<Material, Double> materials = s.explodeMaterials;

        if (RegionUtils.isIn(loc)) {
            Region region = RegionUtils.getAt(loc);
            Guild guild = region.getGuild();

            if (guild.isValid()) {
                event.setCancelled(true);
                return;
            }

            Location protect = region.getCenter().getBlock().getRelative(BlockFace.DOWN).getLocation();

            destroyed.removeIf(block -> block.getLocation().equals(protect));

            guild.setBuild(System.currentTimeMillis() + Settings.getInstance().regionExplode * 1000L);
            for (User user : guild.getMembers()) {
                Player player = this.plugin.getServer().getPlayer(user.getName());
                if (player != null) {
                    player.sendMessage(Messages.getInstance().getMessage("regionExplode")
                                               .replace("{TIME}", Integer.toString(Settings.getInstance().regionExplode)));
                }
            }
        }

        for (Location l : sphere) {
            Material material = l.getBlock().getType();
            if (!materials.containsKey(material)) {
                continue;
            }
            if (material == Material.WATER || material == Material.LAVA) {
                if (RandomizationUtils.chance(materials.get(material))) {
                    l.getBlock().setType(Material.AIR);
                }
            }
            else {
                if (RandomizationUtils.chance(materials.get(material))) {
                    l.getBlock().breakNaturally();
                }
            }
        }
    }
#vulnerable code 
                                @EventHandler
    public void onExplode(EntityExplodeEvent event) {
        List<Block> destroyed = event.blockList();
        Location loc = event.getLocation();
        Settings s = Settings.getInstance();

        List<Location> sphere = SpaceUtils.sphere(loc, s.explodeRadius, s.explodeRadius, false, true, 0);
        Map<Material, Double> materials = s.explodeMaterials;
        for (Location l : sphere) {
            Material material = l.getBlock().getType();
            if (!materials.containsKey(material)) {
                continue;
            }
            if (material == Material.WATER || material == Material.LAVA) {
                if (RandomizationUtils.chance(materials.get(material))) {
                    l.getBlock().setType(Material.AIR);
                }
            }
            else {
                if (RandomizationUtils.chance(materials.get(material))) {
                    l.getBlock().breakNaturally();
                }
            }
        }

        if (!RegionUtils.isIn(loc)) {
            return;
        }
        Region region = RegionUtils.getAt(loc);

        Location protect = region.getCenter().getBlock().getRelative(BlockFace.DOWN).getLocation();

        Iterator<Block> it = destroyed.iterator();
        while (it.hasNext()) {
            if (it.next().getLocation().equals(protect)) {
                it.remove();
            }
        }

        Guild guild = region.getGuild();

        guild.setBuild(System.currentTimeMillis() + Settings.getInstance().regionExplode * 1000L);
        for (User user : guild.getMembers()) {
            Player player = this.plugin.getServer().getPlayer(user.getName());
            if (player != null) {
                player.sendMessage(Messages.getInstance().getMessage("regionExplode")
                        .replace("{TIME}", Integer.toString(Settings.getInstance().regionExplode)));
            }
        }
    } 
                            #location 31 
                            #vulnerability type NULL_DEREFERENCE