Play block sounds?

Discussion in 'Spigot Plugin Development' started by Waldxn, Apr 23, 2017.

  1. So I'm trying to make glass breakable by shooting arrows at them. Here is my code:

    Code (Text):
     @EventHandler
        public void onArrowHit(ProjectileHitEvent phe) {

            Projectile p = phe.getEntity();

            if (phe.getHitBlock().getType().toString() == Material.GLASS.toString()) {

                if (p.toString() == "CraftArrow") {

                    phe.getHitBlock().breakNaturally();
                    phe.getHitBlock().getWorld().playSound(phe.getHitBlock().getLocation(), Sound.BLOCK_GRASS_BREAK, 1, 1);

                }
            }
        }

    It works but won't play the sound.. Any thoughts?
     
  2. Did you mean to have the sound of grass breaking?
     
  3. FACEPALM. Thank you...
     
  4. No problem :p. Make sure you set the thread to solved.
     
  5. You need to create hit block play sound?