[HELP] Pickup Sound

Discussion in 'Plugin Development' started by CreepahMC, Feb 7, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    CreepahMC

    It seems that whenever I pick up any item it plays a ding noise. It should just be emeralds that when picked up, it plays the noise. Any idea what's wrong. I've tried multiple times.

    Code:java
    1. @EventHandler(priority=EventPriority.LOWEST)
    2. public void MoneyPickUp(PlayerPickupItemEvent event) {
    3. if (event.getItem().getItemStack().getType() == Material.EMERALD)
    4. event.getPlayer().sendMessage(ChatColor.GREEN + "+" + ChatColor.GREEN + event.getItem().getItemStack().getAmount() + ChatColor.GREEN + "" + ChatColor.BOLD + "G");
    5. event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1, 1); }
     
  2. Offline

    Gater12

    CreepahMC
    You don't have brackets to form the if body so Java just says run the first line of code below the if statement if the statement is true, and just run the second code anyways.
     
Thread Status:
Not open for further replies.

Share This Page