Custom Resource Pack not working

Discussion in 'Spigot Plugin Development' started by BonseAbaan, Feb 14, 2019 at 1:20 AM.

  1. Hey, I am trying to load custom sounds from a resource pack. Here is the download link to it:
    https://github.com/ABonse/Resource-Pack/blob/master/Resource Pack.zip?raw=true

    My JSON file code is:
    Code (Text):
    {
      "oof": {
        "category": "master",
        "sounds": [
          "sounds"
        ]
      }
    }

    In my plugin code itself, I called this method in the PlayerJoinEvent:
    Code (Java):
    event.getPlayer()
                    .setResourcePack("https://github.com/ABonse/Resource-Pack/blob/master/Resource%20Pack.zip?raw=true");
    And the code I used to play the sound is this:
    Code (Java):
    player.playSound(player.getLocation(), "oof", 10, 1);
    This code runs when I type a command, and yes the command works, i have a message that it also sends as well. Can someone please let me know what I'm doing wrong? Also, I ran a check to see if it was downloading by using the PlayerResourcePackStatusEvent, at first, it successfully downloaded, but when I tried again, it failed? What is wrong with my link and how do I make a compatible direct link. Thanks in advanced!!
     
  2. It isn't a direct link. Use another file host like your website or find the direct link in github if it exists

    Edit: Don't use this method instantly in PlayerJoinEvent: use a delayed task to call player#sendResourcePack
     
    • Like Like x 1

Share This Page