bug fixes

This commit is contained in:
Fangoboyo 2022-06-08 16:23:54 -07:00
parent 214734c519
commit aa0407ae2e
5 changed files with 8 additions and 5 deletions

View File

@ -35,14 +35,14 @@ public class InstallCommand implements CommandExecutor {
try (InputStream in = plugin.openStream()) {
// Installs the plugin
ins.InstallPlugin(in, Install_Jar.toLowerCase(), snder);
ins.InstallPlugin(in, Install_Jar.toLowerCase());
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + Install_Jar.toUpperCase() + ChatColor.WHITE + " plugin!");
return true;
} catch (IOException e) {}
} else if (Install_Jar.equalsIgnoreCase("recommended")) {
InputStream reco1 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/dupepatch.jar")
.toURL().openStream();
ins.InstallPlugin(reco1, "DupePatch", snder);
ins.InstallPlugin(reco1, "DupePatch");
}
} catch (IOException e) {
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database");

View File

@ -16,7 +16,7 @@ import java.util.HashMap;
public class Installer {
public void InstallPlugin(InputStream in, String pluginName, CommandSender s) throws IOException {
public void InstallPlugin(InputStream in, String pluginName) throws IOException {
File f = new File(Main.getInstance().getDataFolder().getParent() + "/" + pluginName + ".jar");
Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
@ -38,8 +38,11 @@ public class Installer {
InputStream in = URI.create("https://github.com/darverdevs/EaglerPluginUpdater/raw/main/out/artifacts/EaglerPluginUpdater_jar/EaglerPluginUpdater.jar")
.toURL().openStream();
System.out.println("Check 3 passed");
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {}
Installer ins = new Installer();
ins.InstallPlugin(in, "EaglerPluginUpdater");
} catch (IOException e) {
System.out.println("Invalid Link");
}
}
}
}