Getting drops for explosions? worldguard explosions

Discussion in 'Plugin Development' started by TheGamesHawk2001, Feb 14, 2015.

Thread Status:
Not open for further replies.
  1. hey all, I have an explosion determimned by chance. I have a prison server and want it so if my explosion happens it only explodes the blocks in the mine where people can build. I tried setting my event to monitor priority and erm, Didn't do much.


        public void onEntityDamage(EntityDamageByBlockEvent event) {
            if(event.getCause().equals(DamageCause.BLOCK_EXPLOSION)) {
                if(event.getDamager() == null)
        @EventHandler(priority = EventPriority.MONITOR)
        public void onBlockBreak(BlockBreakEvent event) {
            Player p = event.getPlayer();
            UUID pid = p.getUniqueId();
            ItemStack is = event.getPlayer().getItemInHand();
            ItemMeta im = is.getItemMeta();
            int lvl = Main.config.getInt(pid.toString() + ".total");
            int ex1 = Main.config.getInt(pid.toString() + ".experience");
            int more = Main.config.getInt("blocks-needed-added-on-to-total") * Main.config.getInt(pid.toString() + ".total");
            double randomNumber = Main.random.nextDouble() * 100;
            double exlvl = (double) Main.config.getInt(pid.toString() + ".exlvl");
            double percentChance = exlvl / 4;
            boolean explode = randomNumber <= percentChance;
            if (explode) {
                p.getLocation().getWorld().createExplosion(event.getBlock().getLocation(), 9);
                p.playSound(p.getLocation(), Sound.EXPLODE, 10, 0);
            }else {
    Last edited: Feb 14, 2015
  2. Offline


    what i can think of but cant put it in action (phone) is to gather the locations ofblocks that will be broken and check if any of those locations belongs in a wb region...
    Sorry if i am not helpful :(
Thread Status:
Not open for further replies.

Share This Page