From 53147aaa6ec426442a78fa2cd36352705bf4b173 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Thu, 30 Apr 2020 00:22:59 +0200 Subject: [PATCH] Switch to new ManagedUpdater This should make the plugin more flexible --- Minepacks/pom.xml | 6 +- Minepacks/resources/lang/de.yml | 8 +-- Minepacks/resources/lang/en.yml | 2 +- Minepacks/resources/lang/fr.yml | 2 +- Minepacks/resources/update.yml | 55 +++++++++++++++++++ .../Minepacks/Bukkit/MagicValues.java | 2 +- .../Minepacks/Bukkit/Minepacks.java | 31 +++-------- pom.xml | 2 +- 8 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 Minepacks/resources/update.yml diff --git a/Minepacks/pom.xml b/Minepacks/pom.xml index 66a8e26..b242d8c 100644 --- a/Minepacks/pom.xml +++ b/Minepacks/pom.xml @@ -23,6 +23,8 @@ PCGF_PluginLib ${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId} + Normal + Release @@ -36,7 +38,7 @@ at.pcgamingfreaks PluginLib - 1.0.23-SNAPSHOT + 1.0.24-SNAPSHOT @@ -141,6 +143,7 @@ ${project.version}-Standalone ${project.groupId}.${project.artifactId}Standalone.Bukkit.${project.artifactId} + Standalone @@ -233,6 +236,7 @@ PCGF_PluginLib ${project.groupId}.${project.artifactId}.Bukkit.${project.artifactId}BadRabbit + Release diff --git a/Minepacks/resources/lang/de.yml b/Minepacks/resources/lang/de.yml index e7e75cc..f5f5f66 100644 --- a/Minepacks/resources/lang/de.yml +++ b/Minepacks/resources/lang/de.yml @@ -1,4 +1,4 @@ -# To simplify the customisation and the translation process please check out the editor: http://ptp.pcgamingfreaks.at +# To simplify the customisation and translation process please check out the editor: https://ptp.pcgamingfreaks.at Language: NotFromConsole: "&cDieser Befehl kann nicht in der Konsole ausgeführt werden." @@ -21,7 +21,7 @@ Language: BackpackCleanedOther: "Der Rucksack von {DisplayName}&r wurde geleert." Open: #Parameter: {TimeLeft} time in seconds till he can reopen his backpack - Cooldown: "&2Bitte warte noch {TimeLeft} Sekunden bis du deinen Rucksack wieder öffnest." + Cooldown: "&2Bitte warte noch {TimeLeft} Sekunden, bis du deinen Rucksack wieder öffnest." #Parameter: {CurrentGameMode}, {AllowedGameModes} WrongGameMode: "Du darfst deinen Rucksack in deinem aktuellem Gamemode nicht öffnen." Sort: @@ -68,9 +68,9 @@ Language: Clean: "Leert deinen Rucksack." CleanOthers: "Leert den Rucksack eines anderen Spielers." OpenOthers: "Öffnet den Rucksack eines anderen Spielers." - Reload: "Lädt die Konfigurations-Datei neu." + Reload: "Lädt die Konfigurationsdatei neu." Update: "Prüft auf neue Plugin-Updates." - Backup: "Erstellt eine Sicherungskopie eines Rucksackes." + Backup: "Erstellt eine Sicherungskopie eines Rucksacks." Restore: "Stellt eine Sicherungskopie eines Rucksacks wieder her." RestoreList: "Listet alle verfügbaren Sicherungskopien von Rucksäcken auf." Version: "Gibt die Versionsdetails über das Plugin und seine Abhängigkeiten aus." diff --git a/Minepacks/resources/lang/en.yml b/Minepacks/resources/lang/en.yml index 7450ecc..0d54ada 100644 --- a/Minepacks/resources/lang/en.yml +++ b/Minepacks/resources/lang/en.yml @@ -1,4 +1,4 @@ -# To simplify the customisation and the translation process please check out the editor: http://ptp.pcgamingfreaks.at +# To simplify the customisation and translation process please check out the editor: https://ptp.pcgamingfreaks.at Language: NotFromConsole: "&cCommand not usable from console." diff --git a/Minepacks/resources/lang/fr.yml b/Minepacks/resources/lang/fr.yml index 26ac7fe..aff10c2 100644 --- a/Minepacks/resources/lang/fr.yml +++ b/Minepacks/resources/lang/fr.yml @@ -112,7 +112,7 @@ Command: # Will be shown in the console during startup LanguageName: "Français" -Author: "Sniper_TVmc" +Author: "HiiRaZ & Sniper_TVmc" # Language file version. Don't touch it! Version: 18 diff --git a/Minepacks/resources/update.yml b/Minepacks/resources/update.yml new file mode 100644 index 0000000..84d0244 --- /dev/null +++ b/Minepacks/resources/update.yml @@ -0,0 +1,55 @@ +UpdateProviders: + Bukkit: + Type: Bukkit + ProjectId: 83445 + Spigot: + Type: Spigot + ProjectId: 19286 + Filename: "minepacks.jar" + GitHub: + Type: GitHub + Owner: GeorgH93 + Repo: Minepacks + GitHubStandalone: + Type: GitHub + Owner: GeorgH93 + Repo: Minepacks + JarSearch: ".*-Standalone\\.jar" + GitHubRelease: + Type: GitHub + Owner: GeorgH93 + Repo: Minepacks + JarSearch: ".*-Release\\.jar" + JenkinsMaster: + Type: Jenkins + Server: "https://ci.pcgamingfreaks.at" + Job: "Minepacks" + JenkinsMasterStandalone: + Type: Jenkins + Server: "https://ci.pcgamingfreaks.at" + Job: "Minepacks" + Filter: ".*-Standalone.jar" + JenkinsMasterRelease: + Type: Jenkins + Server: "https://ci.pcgamingfreaks.at" + Job: "Minepacks" + Filter: ".*-Release.jar" + JenkinsDev: + Type: Jenkins + Server: "https://ci.pcgamingfreaks.at" + Job: "Minepacks Dev" + +UpdateChannels: + Release: + Release: [ Bukkit, Spigot, GitHubRelease ] + Standalone: [ GitHubStandalone ] + Normal: [ GitHub ] + Master: + Release: [ JenkinsMasterRelease ] + Standalone: [ JenkinsMasterStandalone ] + Normal: [ JenkinsMaster ] + Dev: + Normal: [ JenkinsDev ] + +DefaultChannel: "${updateChannel}" +ReleaseType: "${releaseType}" \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java index 2315628..a603c2e 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/MagicValues.java @@ -19,5 +19,5 @@ public class MagicValues { - public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.21-SNAPSHOT"; + public static final String MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.24-SNAPSHOT"; } \ No newline at end of file diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java index f58ed7d..7f6a6de 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Minepacks.java @@ -18,8 +18,8 @@ package at.pcgamingfreaks.Minepacks.Bukkit; import at.pcgamingfreaks.Bukkit.MCVersion; +import at.pcgamingfreaks.Bukkit.ManagedUpdater; import at.pcgamingfreaks.Bukkit.Message.Message; -import at.pcgamingfreaks.Bukkit.Updater; import at.pcgamingfreaks.Bukkit.Utils; import at.pcgamingfreaks.ConsoleColor; import at.pcgamingfreaks.Minepacks.Bukkit.API.Backpack; @@ -35,9 +35,6 @@ import at.pcgamingfreaks.Minepacks.Bukkit.Listener.*; import at.pcgamingfreaks.Minepacks.Bukkit.SpecialInfoWorker.NoDatabaseWorker; import at.pcgamingfreaks.StringUtils; -import at.pcgamingfreaks.Updater.UpdateProviders.BukkitUpdateProvider; -import at.pcgamingfreaks.Updater.UpdateProviders.JenkinsUpdateProvider; -import at.pcgamingfreaks.Updater.UpdateProviders.UpdateProvider; import at.pcgamingfreaks.Updater.UpdateResponseCallback; import at.pcgamingfreaks.Version; @@ -58,11 +55,9 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin { - private static final int BUKKIT_PROJECT_ID = 83445; - @SuppressWarnings("unused") - private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB_DEV = "Minepacks Dev", JENKINS_JOB_MASTER = "Minepacks"; private static Minepacks instance = null; + private ManagedUpdater updater = null; private Config config; private Language lang; private Database database; @@ -115,6 +110,7 @@ public void onEnable() } /*end[STANDALONE]*/ + updater = new ManagedUpdater(this); //region Check compatibility with used minecraft version if(MCVersion.is(MCVersion.UNKNOWN) || !MCVersion.isUUIDsSupportAvailable() || MCVersion.isNewerThan(MCVersion.MC_NMS_1_15_R1)) @@ -141,7 +137,7 @@ public void onEnable() lang = new Language(this); load(); - if(config.getAutoUpdate()) update(null); + if(config.getAutoUpdate()) updater.update(); getLogger().info(StringUtils.getPluginEnabledMessage(getDescription().getName())); } @@ -149,29 +145,16 @@ public void onEnable() public void onDisable() { if(config == null) return; - Updater updater = null; - if(config.getAutoUpdate()) updater = update(null); + if(config.getAutoUpdate()) updater.update(); unload(); - if(updater != null) updater.waitForAsyncOperation(); // Wait for updater to finish + updater.waitForAsyncOperation(); // Wait for an update to finish getLogger().info(StringUtils.getPluginDisabledMessage(getDescription().getName())); instance = null; } - public @Nullable Updater update(@Nullable UpdateResponseCallback updateResponseCallback) + public void update(final @Nullable UpdateResponseCallback updateResponseCallback) { - UpdateProvider updateProvider; - if(getDescription().getVersion().contains("Release")) updateProvider = new BukkitUpdateProvider(BUKKIT_PROJECT_ID, getLogger()); - else - { - /*if[STANDALONE] - updateProvider = new JenkinsUpdateProvider(JENKINS_URL, JENKINS_JOB_MASTER, getLogger(), ".*-Standalone.*"); - else[STANDALONE]*/ - updateProvider = new JenkinsUpdateProvider(JENKINS_URL, JENKINS_JOB_DEV, getLogger()); - /*end[STANDALONE]*/ - } - Updater updater = new Updater(this, true, updateProvider); updater.update(updateResponseCallback); - return updater; } private void load() diff --git a/pom.xml b/pom.xml index 01fa16a..cf83ba9 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ pom - 2.3.6-RC1 + 2.3.6 UTF-8 UTF-8