Solved player.playNote() broken?

Discussion in 'Plugin Development' started by Alshain01, Mar 11, 2014.

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

    Alshain01

    I'm having a problem playing notes to a player. I'm using the following two lines to emulate a doorbell but no matter what I do, I always get the same note twice (using 1.7.2-R0.3) and it's neither of the notes I want. Am I doing something wrong or is this method broken?

    Code:java
    1. // Play first note
    2. for(String s : areaTo.getOwners()) {
    3. final Player owner = Bukkit.getPlayer(s);
    4. if(owner != null) {
    5. owner.playNote(owner.getLocation(), Instrument.PIANO, Note.sharp(1, Note.Tone.G));
    6. }
    7. }
    8.  
    9. // Play second note
    10. new BukkitRunnable() {
    11. @Override
    12. public void run() {
    13. for(String s : areaTo.getOwners()) {
    14. final Player owner = Bukkit.getPlayer(s);
    15. if(owner != null) {
    16. owner.playNote(owner.getLocation(), Instrument.PIANO, Note.natural(0, Note.Tone.E));
    17. }
    18. }
    19. }
    20. }.runTaskLater(plugin, 4);
     
  2. Offline

    MrGermanrain

    @TheGamingGrunts I agree. I think he is using it incorrectly. I personally have not done much with sounds though (Never play with sounds) :p
     
  3. Offline

    Alshain01

    MrGermanrain

    No, I'm afraid that method doesn't give me any note control. The playNote method should be exactly what I want, it just doesn't seem to be working the way it's described.

    The Gaming Grunts Well nevermind, your comment combined with this thread did in fact help. Thanks a bunch!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
Thread Status:
Not open for further replies.

Share This Page