mirror of
https://github.com/darverdevs/EaglerPluginUpdater.git
synced 2024-11-21 10:56:05 -08:00
recompiled
This commit is contained in:
parent
f31a97b6c2
commit
bbc16d209e
|
@ -1,8 +0,0 @@
|
|||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="EaglerPluginInstaller:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/EaglerPluginInstaller_jar</output-path>
|
||||
<root id="archive" name="EaglerPluginInstaller.jar">
|
||||
<element id="module-output" name="EaglerPluginInstaller" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
8
.idea/artifacts/EaglerPluginUpdater_jar.xml
Normal file
8
.idea/artifacts/EaglerPluginUpdater_jar.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="EaglerPluginUpdater:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/EaglerPluginUpdater_jar</output-path>
|
||||
<root id="archive" name="EaglerPluginUpdater.jar">
|
||||
<element id="module-output" name="EaglerPluginUpdater" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
|
@ -7,6 +7,7 @@
|
|||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="Installer" />
|
||||
<module name="EaglerPluginUpdater" />
|
||||
<module name="EaglerPluginInstaller" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
|
|
Binary file not shown.
BIN
out/artifacts/EaglerPluginUpdater_jar/EaglerPluginUpdater.jar
Normal file
BIN
out/artifacts/EaglerPluginUpdater_jar/EaglerPluginUpdater.jar
Normal file
Binary file not shown.
11
pom.xml
11
pom.xml
|
@ -5,13 +5,13 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>tech.nully</groupId>
|
||||
<artifactId>EaglerPluginInstaller</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<artifactId>EaglerPluginUpdater</artifactId>
|
||||
<version>1.0.9</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>EaglerPluginInstaller</name>
|
||||
|
||||
<description>A plugin made to install other plugins from an online repository to eaglercraft servers with a single command</description>
|
||||
<description>An updater for EaglerPluginInstaller</description>
|
||||
<url>nully.tech</url>
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
|
@ -28,6 +28,11 @@
|
|||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.EaglerMaven</groupId>
|
||||
<artifactId>PluginInstaller</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.EaglerMaven</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package tech.nully.PluginInstaller;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
|
||||
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.toLowerCase(), snder);
|
||||
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);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
snder.sendMessage("\"" + Install_Jar + "\"" + "is not a valid plugin from the database");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package tech.nully.PluginInstaller;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Installer {
|
||||
|
||||
public void InstallPlugin(InputStream in, String pluginName, CommandSender s) throws IOException {
|
||||
File f = new File(Main.getInstance().getDataFolder().getParent() + "/" + pluginName + ".jar");
|
||||
Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
public boolean IsValidLink(String url) throws IOException{
|
||||
URL u = new URL(url);
|
||||
HttpURLConnection huc = (HttpURLConnection) u.openConnection();
|
||||
huc.setRequestMethod("GET");
|
||||
huc.connect();
|
||||
return huc.getResponseCode() == 200;
|
||||
}
|
||||
|
||||
public static void InstallUpdater() throws IOException {
|
||||
File file = new File(Main.getInstance().getDataFolder().getParent() + "/EaglerPluginUpdater.jar");
|
||||
if (!(file.exists())) {
|
||||
URL plugin = URI.create("https://github.com/darverdevs/PluginInstaller/raw/Updater/out/artifacts/EaglerPluginUpdater_jar/EaglerPluginUpdater.jar")
|
||||
.toURL();
|
||||
InputStream in = plugin.openStream();
|
||||
Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import org.bukkit.plugin.Plugin;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Main extends JavaPlugin {
|
||||
private static Plugin instance = null;
|
||||
|
@ -16,18 +15,15 @@ public class Main extends JavaPlugin {
|
|||
public void onEnable() {
|
||||
instance = this;
|
||||
try {
|
||||
Installer.InstallUpdater();
|
||||
} catch (IOException e) {}
|
||||
getCommand("install").setExecutor(new InstallCommand());
|
||||
getCommand("plist").setExecutor(new plistCommand());
|
||||
Updater.UpdateInstaller();
|
||||
} catch (IOException e) {
|
||||
System.out.println("PluginUpdater: Error while updating PluginInstaller, please contact Bongo Cat#1100 on discord");
|
||||
}
|
||||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
getServer().getConsoleSender().sendMessage(
|
||||
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " EaglerPluginInstaller V1.0.9 is now Enabled! :D");
|
||||
getServer().getConsoleSender().sendMessage("To use PluginInstaller, run the command \"/install <pluginname>\" (\"install <pluginname>\" in console) to install a plugin");
|
||||
getServer().getConsoleSender().sendMessage("To get a list of installable plugins, use the command \"/plist\" or \"plist\" in console");
|
||||
getServer().getConsoleSender().sendMessage("You can request to add a new plugin to the database by going to https://github.com/darverdevs/PluginInstallerRepo/tree/main");
|
||||
getServer().getConsoleSender().sendMessage("and creating an issue or pull request of the plugin you want to add");
|
||||
ChatColor.GREEN + "[EaglerPluginUpdater]" + ChatColor.AQUA + " EaglerPluginUpdater V1.0.9 is now Enabled! :D");
|
||||
getServer().getConsoleSender().sendMessage("You do not need to do anything, this plugin will automatically update your PluginUpdater on startup");
|
||||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
}
|
||||
|
@ -37,7 +33,7 @@ public class Main extends JavaPlugin {
|
|||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
getServer().getConsoleSender().sendMessage(
|
||||
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " PluginInstaller V1.0.9 is now Disabled! D:");
|
||||
ChatColor.GREEN + "[EaglerPluginUpdater]" + ChatColor.AQUA + " EaglerPluginUpdater V1.0.8 is now Disabled! D:");
|
||||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
getServer().getConsoleSender().sendMessage("--------------------------------------------");
|
||||
}
|
||||
|
|
22
src/main/java/tech/nully/PluginInstaller/Updater.java
Normal file
22
src/main/java/tech/nully/PluginInstaller/Updater.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package tech.nully.PluginInstaller;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
import static org.bukkit.Bukkit.getServer;
|
||||
|
||||
public class Updater {
|
||||
public static void UpdateInstaller() throws IOException {
|
||||
InputStream in = URI.create("https://github.com/darverdevs/PluginInstaller/raw/main/out/artifacts/EaglerPluginInstaller_jar/EaglerPluginInstaller.jar")
|
||||
.toURL().openStream();
|
||||
File f = new File(Main.getInstance().getDataFolder().getParent() + "/EaglerPluginInstaller.jar");
|
||||
f.delete();
|
||||
Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
getServer().getPluginManager().disablePlugin(tech.nully.PluginInstaller.Main.getInstance());
|
||||
getServer().getPluginManager().enablePlugin(tech.nully.PluginInstaller.Main.getInstance());
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package tech.nully.PluginInstaller;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class plistCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (cmd.getName().equalsIgnoreCase("plist")) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Here is a list of available plugins in the database:");
|
||||
// TODO: Finish this list
|
||||
sender.sendMessage("1. Factions 8. AntiSwear");
|
||||
sender.sendMessage("2. ProtocolLib 9. ProtocolLib");
|
||||
sender.sendMessage("3. PermissionSex 10. MCore");
|
||||
sender.sendMessage("4. Vault 11. ");
|
||||
sender.sendMessage("5. CoreProtect 12. ");
|
||||
sender.sendMessage("6. DupePatch 13. ");
|
||||
sender.sendMessage("7. BitchFilter 14. ");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
target/classes/tech/nully/PluginInstaller/Updater.class
Normal file
BIN
target/classes/tech/nully/PluginInstaller/Updater.class
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user