Problem with playSound method in my plugin

Discussion in 'Plugin Development' started by Idol, Nov 29, 2020.

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

    Idol

    Hello guys. I have decided to develop my own plugin, but the sound doesn't work
    through the java methods.
    I have this code(it works if I use minecraft sounds):
    Code:
    @EventHandler
        public void join(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            p.sendMessage("Hello, " + p.getDisplayName());
            p.playSound(p.getLocation(), "prayer.after_praying", 1.0f, 1.0f);
        }
    I have structure of my server resourcepack:
    Structure (open)
    upload_2020-11-30_1-12-57.png

    Resourcepack's sounds.json:
    sounds.json (open)

    Code:
    {
        "prayer.after_praying": {
            "category": "master",
            "sounds": [
              {
                "name": "prayer/after_praying",
                "stream": true
              }
            ]
        }
    }

    1. If I play the embedded sounds it works great.
    2. If I use /playsound command it works too.
    3. If I use playSound method with custom sound it doesn't work
     

    Attached Files:

    jonathanpecany likes this.
  2. Offline

    Chr0mosom3

    As far as I know, you cannot add new sounds to minecraft without using a modified game (mods). You will have to override existing sounds in minecraft with your own.
     
  3. Offline

    jonathanpecany

    @MrDaniel - I believe it is possible to do. Also @Idol did mention that it worked through commands but not in methods so that means it does work as it work go either way. So you can add new sounds. Makes no sense if it works through commands but not through a plugin. If what I am getting from Idol is correct.
     
  4. Offline

    gochi9

Thread Status:
Not open for further replies.

Share This Page