mirror of
https://github.com/darverdevs/PluginInstaller.git
synced 2024-12-03 22:14:19 -08:00
Updated error text
This commit is contained in:
parent
0c4d2e665e
commit
0233ad79c1
|
@ -8,12 +8,12 @@
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
<module name="Installer" />
|
<module name="Installer" />
|
||||||
<module name="EaglerPluginInstaller" />
|
<module name="EaglerPluginInstaller" />
|
||||||
|
<module name="PluginInstaller" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
<bytecodeTargetLevel>
|
<bytecodeTargetLevel>
|
||||||
<module name="EaglerPluginUpdater" target="1.8" />
|
<module name="EaglerPluginUpdater" target="1.8" />
|
||||||
<module name="Installer" target="1.8" />
|
<module name="Installer" target="1.8" />
|
||||||
<module name="PluginInstaller" target="1.8" />
|
|
||||||
<module name="PrimCore" target="1.8" />
|
<module name="PrimCore" target="1.8" />
|
||||||
<module name="untitled" target="1.8" />
|
<module name="untitled" target="1.8" />
|
||||||
</bytecodeTargetLevel>
|
</bytecodeTargetLevel>
|
||||||
|
|
Binary file not shown.
|
@ -18,60 +18,61 @@ public class InstallCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender snder, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender snder, Command cmd, String label, String[] args) {
|
||||||
// Name checker
|
// Name checker
|
||||||
if (cmd.getName().equalsIgnoreCase("install")) {
|
if (snder.isOp() || snder instanceof ConsoleCommandSender) {
|
||||||
if (snder.isOp() || snder instanceof ConsoleCommandSender) {
|
Installer ins = new Installer();
|
||||||
Installer ins = new Installer();
|
// handler for install argument
|
||||||
// handler for install argument
|
if (args.length == 1) {
|
||||||
if (args.length == 1) {
|
String Install_Jar = args[0].toLowerCase();
|
||||||
String Install_Jar = args[0].toLowerCase();
|
// Checks if the created URL is a valid one
|
||||||
|
try {
|
||||||
// Checks if the created URL is a valid one
|
if (ins.IsValidLink("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")) {
|
||||||
try {
|
//plugin URL
|
||||||
if (ins.IsValidLink("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")) {
|
URL plugin = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")
|
||||||
//plugin URL
|
.toURL();
|
||||||
URL plugin = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")
|
// Creates the InputStream
|
||||||
.toURL();
|
try (InputStream in = plugin.openStream()) {
|
||||||
|
// Installs the plugin
|
||||||
// Creates the InputStream
|
ins.InstallPlugin(in, Install_Jar.substring(0, 1).toUpperCase() + Install_Jar.substring(1));
|
||||||
try (InputStream in = plugin.openStream()) {
|
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + Install_Jar.toUpperCase() + ChatColor.WHITE + " plugin!");
|
||||||
|
return true;
|
||||||
// Installs the plugin
|
} catch (IOException e) {
|
||||||
ins.InstallPlugin(in, Install_Jar.substring(0, 1).toUpperCase() + Install_Jar.substring(1));
|
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database");
|
||||||
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();
|
|
||||||
InputStream reco2 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentials.jar")
|
|
||||||
.toURL().openStream();
|
|
||||||
InputStream reco3 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentialsspawn.jar")
|
|
||||||
.toURL().openStream();
|
|
||||||
InputStream reco4 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/authme.jar")
|
|
||||||
.toURL().openStream();
|
|
||||||
InputStream reco5 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/worldedit.jar")
|
|
||||||
.toURL().openStream();
|
|
||||||
InputStream reco6 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/bitchfilter.jar")
|
|
||||||
.toURL().openStream();
|
|
||||||
ins.InstallPlugin(reco1, "DupePatch");
|
|
||||||
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "DupePatch" + ChatColor.WHITE + " plugin!");
|
|
||||||
ins.InstallPlugin(reco2, "Essentials");
|
|
||||||
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "Essentials" + ChatColor.WHITE + " plugin!");
|
|
||||||
ins.InstallPlugin(reco3, "EssentialsSpawn");
|
|
||||||
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "EssentialsSpawn" + ChatColor.WHITE + " plugin!");
|
|
||||||
ins.InstallPlugin(reco4, "AuthMe");
|
|
||||||
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "AuthMe" + ChatColor.WHITE + " plugin!");
|
|
||||||
ins.InstallPlugin(reco5, "Worldedit");
|
|
||||||
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "Worldedit" + ChatColor.WHITE + " plugin!");
|
|
||||||
ins.InstallPlugin(reco6, "BitchFilter");
|
|
||||||
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "BitchFilter" + ChatColor.WHITE + " plugin!");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} else if (Install_Jar.equalsIgnoreCase("recommended")) {
|
||||||
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database");
|
InputStream reco1 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/dupepatch.jar")
|
||||||
|
.toURL().openStream();
|
||||||
|
InputStream reco2 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentials.jar")
|
||||||
|
.toURL().openStream();
|
||||||
|
InputStream reco3 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/essentialsspawn.jar")
|
||||||
|
.toURL().openStream();
|
||||||
|
InputStream reco4 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/authme.jar")
|
||||||
|
.toURL().openStream();
|
||||||
|
InputStream reco5 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/worldedit.jar")
|
||||||
|
.toURL().openStream();
|
||||||
|
InputStream reco6 = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/bitchfilter.jar")
|
||||||
|
.toURL().openStream();
|
||||||
|
ins.InstallPlugin(reco1, "DupePatch");
|
||||||
|
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "DupePatch" + ChatColor.WHITE + " plugin!");
|
||||||
|
ins.InstallPlugin(reco2, "Essentials");
|
||||||
|
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "Essentials" + ChatColor.WHITE + " plugin!");
|
||||||
|
ins.InstallPlugin(reco3, "EssentialsSpawn");
|
||||||
|
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "EssentialsSpawn" + ChatColor.WHITE + " plugin!");
|
||||||
|
ins.InstallPlugin(reco4, "AuthMe");
|
||||||
|
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "AuthMe" + ChatColor.WHITE + " plugin!");
|
||||||
|
ins.InstallPlugin(reco5, "Worldedit");
|
||||||
|
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "Worldedit" + ChatColor.WHITE + " plugin!");
|
||||||
|
ins.InstallPlugin(reco6, "BitchFilter");
|
||||||
|
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + "BitchFilter" + ChatColor.WHITE + " plugin!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
snder.sendMessage("You have provided too many arguments!");
|
||||||
|
snder.sendMessage("The correct usage of this command is: /install <plugin>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user