Force update Server Resource Pack?

Discussion in 'Plugin Development' started by kayc01, Nov 29, 2016.

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


    Hi, quick question. I hope...

    I have a Server Resource Pack that I am always updating that is linked to my GitHub.
    Github Link:

    It uses this link to download via Server Properties (Direct Download):

    This is not a clone of the Git, I had to upload the .zip file to GitHub to download the .zip.
    Direct Downloading via Clone Git broke the Structure of the resource pack as it put the GitHub Repository Folder outside of the Assets meaning Minecraft could not read the pack.meta, etc...

    So, essentially whenever I update the resource pack I make sure it is named and the new .zip file works as it still has the same URL for direct download.

    My question is, how can I force the Server Resource pack to auto update when I push a new version of it?
    - I cannot check again version [#] or something in the name of the .zip because the name of the resource pack .zip must always be "".

    I saw this; "player.setResourcePack("");" which may work ( I am yet to test it, because...) however I would like it to be as automatic as possible and getting them to download a resource pack mid game will be troublesome for the players.

    My Idea's:
    - Somehow get the GitHub push upload date of the .zip and compare it to the file created date of the server resource pack in ".minecraft/server-resource-packs/"

    - When I have updated the resource pack to GitHub, I join the server and type a command that sets a boolean true. Then, when anyone joins the server it downloads the pack and adds the user to a list meaning if he leaves and re-joins he won't have to redownload it until a server restart.

    - Similar - Force everyone to download after a server restart.

    - Will the "player.setResourcePack("");" even work if they already have a version of the resource pack in there server-resource-packs folder? Will minecraft think its the same file and Ignore the .setResourcePack? Any suggestions and extra knowledge very welcomed. I hope the info supplied clears a few questions you might have. Thanks!
  2. Offline


    This is what you will need to do:
    1. When a player joins the server, force them to download the resourcepack (use setResourcepack).
    2. If they do not accept, stop them from joining/ask them to set their resourcepack. (you don't want people using the older resourcepack.)
    3. In your git page, keep a file that contains the version. On your server, keep an int which represents the the server's version. Every minute/ 5 minutes/ whenever, check the version. If the version changed in any way, force the new resourcepack.
    To answer your last question, yes, setResourecepack overrides existing resourcepacks.
  3. Offline


    Hey, thanks for the response!
    How could I do step 3?

    As I mentioned the Resource has to be called "", no matter what.
    Without any version number changes.

    So I sort of get what you mean by the 3rd step, yet I do not because how would I check what the player has?
    To prevent everyone having to re-download it every time they join?

    Is there any way around this?

    Just thought of this...
    I type a command that says "/resourcepack version 3.5"

    Which sets a config saying current version is 3.5

    So, when a player joins it sets the "current version" as 3.5 for that player in a separate player file.

    Then, when I update the resource pack I hop in game and type "/resourcepack version 3.6"

    When a player joins, it checks that the version under the player file is the same as the new version.
    If it is > that the current version in the main config then it asks them to redownload the new texturepack via the on screen prompt.

    Only question is with this, is there any way I could prevent myself having to do a command like "/resourcepack version 3.6" and make it automatic? (Not sure if getting a GitHub file is possible to read)

    Thanks Again
  4. Offline


    @kayc01 somewhat related

    It is not possible to "force" a user to install a resource pack. The user can be asked to install it, but there is no way to force install one for obvious reasons. You can kick players that won't use it, though.
Thread Status:
Not open for further replies.

Share This Page