mfnalex / ChestSort

Best sorting plugin for Minecraft / Spigot 1.14+
https://www.chestsort.de
GNU General Public License v3.0
91 stars 34 forks source link

Auto updater #141

Open TIBTHINK opened 2 years ago

TIBTHINK commented 2 years ago

for an auto-updater to work you have two options on how to approach this

  1. have the plugin pull the source code from git and compile it on server startup.
  2. (easier option in the long run) compile the plugin and then release it on Github or Jenkins for GitHub, I suggest making a JSON file with the latest release and then having it download the latest version. for Jenkins, I believe it will compile your latest push and then auto release the jar
TIBTHINK commented 2 years ago

i was able to make a python script that does just that, using GitHub's API to find and update new releases

pwd = os.getcwd()
class plugins():
    def github_downloader(url, name, sub=1):
        dynmap_response = requests.get(url)
        data = dynmap_response.json()
        spigot_number = len(data[1]['assets'])
        download_link = print(data[1]['assets'][spigot_number - sub]['browser_download_url'])
        open(pwd + "/plugins/" + name, 'wb').write(requests.get(download_link).content)

plugins.github_downloader("https://api.github.com/repos/webbukkit/dynmap/releases", "Dynmap.jar")
plugins.github_downloader("https://api.github.com/repos/PryPurity/WorldBorder/releases", "WorldBorder.jar")
plugins.github_downloader("https://api.github.com/repos/EssentialsX/Essentials/releases", "EssentialsX.jar", 8 )
mfnalex commented 2 years ago

But doesn't that require to also have maven, JDK etc installed?