imported the plugin

This commit is contained in:
Fangoboyo 2022-06-08 12:26:38 -07:00
parent ef475797bb
commit f31a97b6c2
23 changed files with 366 additions and 0 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,8 @@
<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>

20
.idea/compiler.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Installer" />
<module name="EaglerPluginInstaller" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<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>
</component>
</project>

7
.idea/discord.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

9
.idea/encodings.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/untitled/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/untitled/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.net.URL,openStream" />
</inspection_tool>
</profile>
</component>

25
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="PrimCoreRepos-repos" />
<option name="name" value="PrimCoreRepos-repos" />
<option name="url" value="https://github.com/darverdevs/EaglerMavenRepo/raw/main" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

24
.idea/misc.xml Normal file
View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
<option name="ignoredFiles">
<set>
<option value="$PROJECT_DIR$/untitled/pom.xml" />
</set>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

12
EaglerPluginInstaller.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
</module>

6
README.md Normal file
View File

@ -0,0 +1,6 @@
# PluginInstaller
PluginInstaller is a plugin designed for eaglercraft that can install plugins from an [online repository](https://github.com/darverdevs/PluginInstallerRepo) to your server just with a /install <plugin> command.
This plugin also has an autoupdater so theres no need to constantly redownload the plugin.
#### **The download link is [here](https://github.com/darverdevs/PluginInstaller/raw/main/out/artifacts/PluginInstaller_jar/PluginInstaller.jar)**
## How to contribute:
Since PluginInstaller runs on an autoupdater, all contributions must be made from pull requests either by forks or branches approved by someone in the darverdevs group and tested before a pull request is made

39
pom.xml Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>tech.nully</groupId>
<artifactId>EaglerPluginInstaller</artifactId>
<version>1.0.0</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>
<url>nully.tech</url>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>PrimCoreRepos-repos</id>
<url>https://github.com/darverdevs/EaglerMavenRepo/raw/main</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.EaglerMaven</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.5.2-R1.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,55 @@
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;
}
}

View File

@ -0,0 +1,41 @@
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);
}
}
}

View File

@ -0,0 +1,44 @@
package tech.nully.PluginInstaller;
import org.bukkit.ChatColor;
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;
public static Plugin getInstance() {
return instance;
}
@Override
public void onEnable() {
instance = this;
try {
Installer.InstallUpdater();
} catch (IOException e) {}
getCommand("install").setExecutor(new InstallCommand());
getCommand("plist").setExecutor(new plistCommand());
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");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
}
@Override
public void onDisable() {
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage(
ChatColor.GREEN + "[EaglerPluginInstaller]" + ChatColor.AQUA + " PluginInstaller V1.0.9 is now Disabled! D:");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage("--------------------------------------------");
}
}

View File

@ -0,0 +1,24 @@
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;
}
}

View File

@ -0,0 +1,15 @@
name: EaglerPluginInstaller
version: 1.0.9
main: tech.nully.PluginInstaller.Main
prefix: [PluginInstaller]
loadbefore: [PluginUpdater]
authors: [BongoCat]
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository
website: nully.tech
commands:
install:
usage: /<command> <plugin>
description: Installs the latest compatible version of the requested plugin
plist:
usage: /<command>
description: Gives you a list of available plugins with PluginInstaller

15
target/classes/plugin.yml Normal file
View File

@ -0,0 +1,15 @@
name: EaglerPluginInstaller
version: 1.0.9
main: tech.nully.PluginInstaller.Main
prefix: [PluginInstaller]
loadbefore: [PluginUpdater]
authors: [BongoCat]
description: A plugin that is capable of installing the latest compatible version of plugins with eaglercraft from an online repository
website: nully.tech
commands:
install:
usage: /<command> <plugin>
description: Installs the latest compatible version of the requested plugin
plist:
usage: /<command>
description: Gives you a list of available plugins with PluginInstaller

Binary file not shown.