added updater

This commit is contained in:
Fangoboyo 2022-06-07 20:30:41 -07:00
parent e0eefa43c6
commit 90d9fda4b0
32 changed files with 231 additions and 0 deletions

96
.idea/workspace.xml Normal file
View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ArtifactsWorkspaceSettings">
<artifacts-to-build>
<artifact name="PluginInstaller:jar" />
</artifacts-to-build>
</component>
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="4bd148f5-48ec-4f70-b445-1bf5ebe2ae24" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/artifacts/PluginInstaller_jar.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/discord.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/jarRepositories.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/PluginInstaller.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/artifacts/PluginInstaller_jar/PluginInstaller.jar" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/tech/nully/PluginInstaller/InstallCommand.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/tech/nully/PluginInstaller/Installer.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/tech/nully/PluginInstaller/Main.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/tech/nully/PluginInstaller/plistCommand.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/resources/plugin.yml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/plugin.yml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/tech/nully/PluginInstaller/InstallCommand.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/tech/nully/PluginInstaller/Installer.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/tech/nully/PluginInstaller/Main.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/tech/nully/PluginInstaller/plistCommand.class" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="2AH6P7GhGPR7WovuPaqPyOlZaIM" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="autoscrollToSource" value="true" />
<option name="flattenModules" value="true" />
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;
}
}</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="4bd148f5-48ec-4f70-b445-1bf5ebe2ae24" name="Changes" comment="" />
<created>1654654153315</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1654654153315</updated>
<workItem from="1654654155644" duration="2772000" />
<workItem from="1654658505151" duration="471000" />
</task>
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
</project>

View File

@ -21,6 +21,7 @@ public class Main extends JavaPlugin {
} catch (IOException e) {} } catch (IOException e) {}
getCommand("install").setExecutor(new InstallCommand()); getCommand("install").setExecutor(new InstallCommand());
getCommand("plist").setExecutor(new plistCommand()); getCommand("plist").setExecutor(new plistCommand());
getCommand("update").setExecutor(new UpdateCommand());
getServer().getConsoleSender().sendMessage("--------------------------------------------"); getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage("--------------------------------------------"); getServer().getConsoleSender().sendMessage("--------------------------------------------");
getServer().getConsoleSender().sendMessage( getServer().getConsoleSender().sendMessage(

View File

@ -0,0 +1,24 @@
package tech.nully.PluginInstaller;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import java.io.IOException;
public class UpdateCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender Sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("update")) {
if (Sender.isOp() || Sender instanceof ConsoleCommandSender) {
try {
Installer.UpdatePlugin();
} catch (IOException e) {}
Sender.sendMessage("The latest download of the plugin has been installed, please reload the server or reload the plugin to have the changes take effect");
return true;
}
}
return false;
}
}

View File

@ -12,3 +12,6 @@ commands:
plist: plist:
usage: /<command> usage: /<command>
description: Gives you a list of available plugins with PluginInstaller description: Gives you a list of available plugins with PluginInstaller
update:
usage: /<command>
description: Updates the plugin to the latest version

8
Updater/.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,13 @@
<?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="Updater" />
</profile>
</annotationProcessing>
</component>
</project>

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>

View File

@ -0,0 +1,20 @@
<?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="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>

14
Updater/.idea/misc.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</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
Updater/.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>

39
Updater/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>PrimCore</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>PrimCore</name>
<description>A custom coded plugin for primcraft written in Kotlin</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>