mirror of
https://github.com/darverdevs/PluginInstaller.git
synced 2024-11-22 01:06:06 -08:00
changed to adapt to PluginUpdater
This commit is contained in:
parent
fbc88b0737
commit
7f17ebd863
|
@ -29,11 +29,13 @@ public class Installer {
|
|||
return huc.getResponseCode() == 200;
|
||||
}
|
||||
|
||||
public static void UpdatePlugin() throws IOException {
|
||||
InputStream in = URI.create("https://github.com/darverdevs/PluginInstaller/raw/main/out/artifacts/PluginInstaller_jar/PluginInstaller.jar")
|
||||
.toURL().openStream();
|
||||
File f = new File(Main.getInstance().getDataFolder().getParent() + "/" + "PluginInstaller" + ".jar");
|
||||
f.delete();
|
||||
Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
public static void InstallUpdater() throws IOException {
|
||||
File file = new File(Main.getInstance().getDataFolder().getParent() + "/PluginUpdater.jar");
|
||||
if (!(file.exists())) {
|
||||
URL plugin = URI.create("https://github.com/darverdevs/PluginInstaller/tree/Updater/out/artifacts/PluginUpdater_jar")
|
||||
.toURL();
|
||||
InputStream in = plugin.openStream();
|
||||
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,7 @@ public class Main extends JavaPlugin {
|
|||
public void onEnable() {
|
||||
instance = this;
|
||||
try {
|
||||
Installer.UpdatePlugin();
|
||||
System.out.println(ChatColor.AQUA + "PluginInstaller has been udpated");
|
||||
Installer.InstallUpdater();
|
||||
} catch (IOException e) {}
|
||||
getCommand("install").setExecutor(new InstallCommand());
|
||||
getCommand("plist").setExecutor(new plistCommand());
|
||||
|
|
|
@ -2,6 +2,7 @@ name: EaglerPluginInstaller
|
|||
version: 1.0.8
|
||||
main: tech.nully.PluginInstaller.Main
|
||||
prefix: [PluginInstaller]
|
||||
loadbefore: [PluginUpdater]
|
||||
authors: [BongoCat]
|
||||
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft
|
||||
website: nully.tech
|
||||
|
|
Loading…
Reference in New Issue
Block a user