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()) { try (InputStream in = plugin.openStream()) {
// Installs the plugin // 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!"); snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + Install_Jar.toUpperCase() + ChatColor.WHITE + " plugin!");
return true; return true;
} catch (IOException e) {} } catch (IOException e) {}
} else if (Install_Jar.equalsIgnoreCase("recommended")) { } else if (Install_Jar.equalsIgnoreCase("recommended")) {
InputStream reco1 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/dupepatch.jar") InputStream reco1 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/dupepatch.jar")
.toURL().openStream(); .toURL().openStream();
ins.InstallPlugin(reco1, "DupePatch", snder); ins.InstallPlugin(reco1, "DupePatch");
} }
} catch (IOException e) { } catch (IOException e) {
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database"); 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 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"); File f = new File(Main.getInstance().getDataFolder().getParent() + "/" + pluginName + ".jar");
Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING); 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") InputStream in = URI.create("https://github.com/darverdevs/EaglerPluginUpdater/raw/main/out/artifacts/EaglerPluginUpdater_jar/EaglerPluginUpdater.jar")
.toURL().openStream(); .toURL().openStream();
System.out.println("Check 3 passed"); System.out.println("Check 3 passed");
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING); Installer ins = new Installer();
} catch (IOException e) {} ins.InstallPlugin(in, "EaglerPluginUpdater");
} catch (IOException e) {
System.out.println("Invalid Link");
}
} }
} }
} }