Updated error text

This commit is contained in:
BongoCat 2022-08-06 13:28:06 -07:00
parent 0c4d2e665e
commit 0233ad79c1
4 changed files with 51 additions and 50 deletions

View File

@ -8,12 +8,12 @@
<outputRelativeToContentRoot value="true" />
<module name="Installer" />
<module name="EaglerPluginInstaller" />
<module name="PluginInstaller" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="EaglerPluginUpdater" target="1.8" />
<module name="Installer" target="1.8" />
<module name="PluginInstaller" target="1.8" />
<module name="PrimCore" target="1.8" />
<module name="untitled" target="1.8" />
</bytecodeTargetLevel>

View File

@ -18,60 +18,61 @@ public class InstallCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender snder, Command cmd, String label, String[] args) {
// Name checker
if (cmd.getName().equalsIgnoreCase("install")) {
if (snder.isOp() || snder instanceof ConsoleCommandSender) {
Installer ins = new Installer();
// handler for install argument
if (args.length == 1) {
String Install_Jar = args[0].toLowerCase();
// Checks if the created URL is a valid one
try {
if (ins.IsValidLink("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")) {
//plugin URL
URL plugin = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")
.toURL();
// Creates the InputStream
try (InputStream in = plugin.openStream()) {
// Installs the plugin
ins.InstallPlugin(in, Install_Jar.substring(0, 1).toUpperCase() + Install_Jar.substring(1));
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!");
if (snder.isOp() || snder instanceof ConsoleCommandSender) {
Installer ins = new Installer();
// handler for install argument
if (args.length == 1) {
String Install_Jar = args[0].toLowerCase();
// Checks if the created URL is a valid one
try {
if (ins.IsValidLink("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")) {
//plugin URL
URL plugin = URI.create("https://github.com/darverdevs/PluginInstallerRepo/raw/main/" + Install_Jar + ".jar")
.toURL();
// Creates the InputStream
try (InputStream in = plugin.openStream()) {
// Installs the plugin
ins.InstallPlugin(in, Install_Jar.substring(0, 1).toUpperCase() + Install_Jar.substring(1));
snder.sendMessage("You have successfully installed the " + ChatColor.GREEN + Install_Jar.toUpperCase() + ChatColor.WHITE + " plugin!");
return true;
} catch (IOException e) {
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database");
return true;
}
} catch (IOException e) {
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database");
} 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;
}
} 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;