Solved /playsound without Console message

Discussion in 'Plugin Development' started by mrCookieSlime, Jun 10, 2014.

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

    mrCookieSlime

    He guys,

    recently I was experimenting with a custom Resource Pack and added a couple sounds to it.
    For a plugin im working on I need those custom Sounds, currently im using the console to execute:
    /playsound sonic_screwdriver Moewe1
    But it always prints out this annoying message
    Played "sonic_screwdriver" to Moewe1
    So I was wondering if there is a method in Bukkit to do this without this message.
    NOTE: I am not looking for .playSound() because it cannot play Sounds of Resource Packs
     
  2. Offline

    fireblast709

  3. Offline

    mrCookieSlime

  4. Offline

    fireblast709

    mrCookieSlime there are some good packet libraries out there.
     
  5. Offline

    BlueMustache

    mrCookieSlime

    Code:java
    1. @Deprecated
    2. public abstract void playSound(Location paramLocation, String paramString, float paramFloat1, float paramFloat2);


    The above is just like the bukkit plays sound, only you can define the sound.
    Replace paramString, with say "mob.ghast.moan"

    Example:
    Code:java
    1. p.playSound(p.getLocation(), "mob.ghast.moan", 1, 1);


    Hope this helps! :D

    EDIT: This should work with custom sounds.
    If it does not work with aliases, then try a direct path.
    Put the sound in say... "Portal" (Bad Example)
    Then you could recall it as, "portal.sonic_screwdriver".
    P.P.S I love Dr.Who!
     
    mrCookieSlime and Garris0n like this.
  6. Offline

    mrCookieSlime

    BlueMustache
    Oh my... it works! Thanks man.
    I thought this method would only accept the enum names like ENDERMAN_TELEPORT or so, but no it does actually send the packet to the player.
    And if you are not using the Resource Pack it doesnt even throw an exception, so I dont even need to put a try/catch in there.

    Also:
    I have labelled the Sound in the sounds.json as sonic_screwdriver, so no Path needed ;)

    PS: I <3 Doctor Who as well
     
  7. Offline

    BlueMustache

    mrCookieSlime
    Glad I could help! ;)

    EDIT: Don't forget to mark as solved.
     
  8. Offline

    mrCookieSlime

Thread Status:
Not open for further replies.

Share This Page