From 9175d6e82498b8017eff17efcd2ac67fe9394bc8 Mon Sep 17 00:00:00 2001 From: Fangoboyo <77935781+Fangoboyo@users.noreply.github.com> Date: Tue, 7 Jun 2022 10:20:22 -0700 Subject: [PATCH] loaded in project --- .idea/.gitignore | 8 ++++ .idea/compiler.xml | 13 +++++++ .idea/discord.xml | 7 ++++ .idea/encodings.xml | 7 ++++ .idea/jarRepositories.xml | 25 ++++++++++++ .idea/misc.xml | 19 +++++++++ PluginInstaller.iml | 12 ++++++ pom.xml | 39 +++++++++++++++++++ .../nully/PluginInstaller/InstallCommand.java | 33 ++++++++++++++++ .../tech/nully/PluginInstaller/Installer.java | 20 ++++++++++ .../java/tech/nully/PluginInstaller/Main.java | 20 ++++++++++ 11 files changed, 203 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/discord.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 PluginInstaller.iml create mode 100644 pom.xml create mode 100644 src/main/java/tech/nully/PluginInstaller/InstallCommand.java create mode 100644 src/main/java/tech/nully/PluginInstaller/Installer.java create mode 100644 src/main/java/tech/nully/PluginInstaller/Main.java diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -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 diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..ee785cf --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..30bab2a --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..fe537f9 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..18fe036 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PluginInstaller.iml b/PluginInstaller.iml new file mode 100644 index 0000000..4ec1b0e --- /dev/null +++ b/PluginInstaller.iml @@ -0,0 +1,12 @@ + + + + + + + BUKKIT + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..4cd0078 --- /dev/null +++ b/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + tech.nully + PrimCore + 1.0.0 + jar + + PrimCore + + A custom coded plugin for primcraft written in Kotlin + nully.tech + + 1.8 + UTF-8 + 1.8 + 1.8 + + + + + PrimCoreRepos-repos + https://github.com/darverdevs/EaglerMavenRepo/raw/main + + + + + + com.github.EaglerMaven + craftbukkit + 1.5.2-R1.0 + + + + + \ No newline at end of file diff --git a/src/main/java/tech/nully/PluginInstaller/InstallCommand.java b/src/main/java/tech/nully/PluginInstaller/InstallCommand.java new file mode 100644 index 0000000..861a711 --- /dev/null +++ b/src/main/java/tech/nully/PluginInstaller/InstallCommand.java @@ -0,0 +1,33 @@ +package tech.nully.PluginInstaller; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.craftbukkit.libs.org.ibex.nestedvm.util.Seekable; + +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class InstallCommand implements CommandExecutor { + @Override + public boolean onCommand(CommandSender snder, Command cmd, String label, String[] args) { + if (cmd.getName().equalsIgnoreCase("installpl")) { + Installer ins = new Installer(); + String Install_Jar = cmd.getName(); + if (ins.JARURLs.containsKey(Install_Jar)) { + try (InputStream in = URI.create(ins.JARURLs.get(Install_Jar)).toURL().openStream()) { + ins.InstallPlugin(in); + } catch (IOException e) { + } + + + } + } + return false; + } +} diff --git a/src/main/java/tech/nully/PluginInstaller/Installer.java b/src/main/java/tech/nully/PluginInstaller/Installer.java new file mode 100644 index 0000000..628fa76 --- /dev/null +++ b/src/main/java/tech/nully/PluginInstaller/Installer.java @@ -0,0 +1,20 @@ +package tech.nully.PluginInstaller; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; +import java.util.HashMap; + +public class Installer { + public HashMap JARURLs = new HashMap<>(); + + public static void SetupInstaller() { + Installer ins = new Installer(); + ins.JARURLs.put("dynmap", "https://github.com/darverdevs/PluginInstallerRepo/raw/main/dynmap-1.9.1.jar"); + } + + public void InstallPlugin(InputStream in) throws IOException { + Files.copy(in, Main.getInstance().getDataFolder().toPath(), StandardCopyOption.REPLACE_EXISTING); + } +} diff --git a/src/main/java/tech/nully/PluginInstaller/Main.java b/src/main/java/tech/nully/PluginInstaller/Main.java new file mode 100644 index 0000000..08fadb2 --- /dev/null +++ b/src/main/java/tech/nully/PluginInstaller/Main.java @@ -0,0 +1,20 @@ +package tech.nully.PluginInstaller; + +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.JavaPlugin; + +public class Main extends JavaPlugin { + private static Plugin instance = null; + public static Plugin getInstance() { + return instance; + } + @Override + public void onEnable() { + instance = this; + } + + @Override + public void onDisable() { + getLogger().info("Plugin has been disabled!"); + } +}