From 54244cdb0bb2c81a712bd2d6df26b023b248e90f Mon Sep 17 00:00:00 2001 From: Prouser123 Date: Fri, 17 May 2019 17:41:57 +0100 Subject: [PATCH] Fix for working build --- .classpath | 20 ++++ .project | 23 +++++ dependency-reduced-pom.xml | 98 +++++++++++++++++++ pom.xml | 22 ++--- .../placeholderapi/PlaceholderAPI.java | 7 -- .../internal/updater/MVdWUpdaterHook.java | 85 ---------------- 6 files changed, 149 insertions(+), 106 deletions(-) create mode 100644 .classpath create mode 100644 .project create mode 100644 dependency-reduced-pom.xml delete mode 100644 src/main/java/be/maximvdw/placeholderapi/internal/updater/MVdWUpdaterHook.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..7c632d2 --- /dev/null +++ b/.classpath @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..993755a --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + MVdWPlaceholderAPI + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml new file mode 100644 index 0000000..99da274 --- /dev/null +++ b/dependency-reduced-pom.xml @@ -0,0 +1,98 @@ + + + 4.0.0 + x2.forks-be.maximvdw + MVdWPlaceholderAPI + MVdWPlaceholderAPI + 2.5.1-FIXED-SNAPSHOT + Placeholder API for MVdW Software plugins + + + + true + ${basedir} + + *.yml + + + + MVdWPlaceholderAPI + + + maven-jar-plugin + 2.3.2 + + MVdWPlaceholderAPI + + + + maven-compiler-plugin + 3.2 + + 1.7 + 1.7 + UTF-8 + false + + + + maven-shade-plugin + 3.1.0 + + + package + + shade + + + + + + + org.bstats:* + + + + + org.bstats + be.maximvdw.placeholderapi.internal.bstats + + + + + + maven-surefire-plugin + 2.12 + + junit:junit + -Xms256m -Xmx512m -XX:MaxPermSize=128m -ea + -Dfile.encoding=UTF-8 + + + + + + + public + Public Repositories + http://repo.mvdw-software.be/content/groups/public/ + + + bstats-repo + http://repo.bstats.org/content/repositories/releases/ + + + prouser123-public + https://repo.prouser123.me/repository/maven-public/ + + + + + org.spigotmc + spigot-api + 1.10-R0.1-SNAPSHOT + compile + + + + diff --git a/pom.xml b/pom.xml index c3a6ea4..f8162c3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,9 @@ 4.0.0 - be.maximvdw + x2.forks-be.maximvdw MVdWPlaceholderAPI - 2.5.1-SNAPSHOT + 2.5.1-FIXED-SNAPSHOT MVdWPlaceholderAPI Placeholder API for MVdW Software plugins @@ -12,26 +12,20 @@ Public Repositories http://repo.mvdw-software.be/content/groups/public/ - - mvdw-software - Private Projects - http://repo.mvdw-software.be/content/groups/private-group/ - bstats-repo http://repo.bstats.org/content/repositories/releases/ + + prouser123-public + https://repo.prouser123.me/repository/maven-public/ + - - be.maximvdw - MVdWUpdater - 1.6.0-SNAPSHOT - org.spigotmc - spigot - 1.9 + spigot-api + 1.10-R0.1-SNAPSHOT org.bstats diff --git a/src/main/java/be/maximvdw/placeholderapi/PlaceholderAPI.java b/src/main/java/be/maximvdw/placeholderapi/PlaceholderAPI.java index 8c180d1..e4dcdf7 100644 --- a/src/main/java/be/maximvdw/placeholderapi/PlaceholderAPI.java +++ b/src/main/java/be/maximvdw/placeholderapi/PlaceholderAPI.java @@ -5,7 +5,6 @@ import be.maximvdw.placeholderapi.internal.PlaceholderPack; import be.maximvdw.placeholderapi.internal.PlaceholderPlugin; import be.maximvdw.placeholderapi.internal.ui.SendConsole; -import be.maximvdw.placeholderapi.internal.updater.MVdWUpdaterHook; import be.maximvdw.placeholderapi.internal.utils.DateUtils; import be.maximvdw.placeholderapi.internal.utils.NumberUtils; import be.maximvdw.placeholderapi.internal.utils.bukkit.BukkitUtils; @@ -48,12 +47,6 @@ public void onEnable() { new NumberUtils(); int resource = 11182; - try { - if (Bukkit.getPluginManager().isPluginEnabled("MVdWUpdater")) - new MVdWUpdaterHook(this, resource); - } catch (Throwable ex) { - // No updater - } SendConsole.info("Sending metrics ..."); try { diff --git a/src/main/java/be/maximvdw/placeholderapi/internal/updater/MVdWUpdaterHook.java b/src/main/java/be/maximvdw/placeholderapi/internal/updater/MVdWUpdaterHook.java deleted file mode 100644 index 6078fe8..0000000 --- a/src/main/java/be/maximvdw/placeholderapi/internal/updater/MVdWUpdaterHook.java +++ /dev/null @@ -1,85 +0,0 @@ -package be.maximvdw.placeholderapi.internal.updater; - -import be.maximvdw.mvdwupdater.MVdWUpdater; -import be.maximvdw.mvdwupdater.spigotsite.api.resource.Resource; -import be.maximvdw.placeholderapi.internal.ui.SendConsole; -import be.maximvdw.placeholderapi.internal.utils.bukkit.Version; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; - -import java.io.File; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; - -/** - * MVdW Updater Hook - * - * @author Maxim Van de Wynckel - */ -public class MVdWUpdaterHook { - private static boolean updated = false; - - public MVdWUpdaterHook(Plugin plugin, int resourceId) { - try { - MVdWUpdater updater = (MVdWUpdater) Bukkit.getPluginManager().getPlugin("MVdWUpdater"); - SendConsole.info("Hooked into MVdWUpdater!"); - - - // Resource id found - SendConsole.info("Checking for new updates for: " + plugin.getName() + " ..."); - - // Compare versions - Version currentPluginVersion = new Version(plugin.getDescription().getVersion()); - Version newPluginVersion = new Version(updater.getResourceVersionString(resourceId)); - - if (currentPluginVersion.compare(newPluginVersion) == 1) { - SendConsole.info("An update for '" + plugin.getName() + "' is available"); - - // Do not update if the update is a major version - if (currentPluginVersion.getMajor() != newPluginVersion.getMajor()) { - SendConsole.info("Update is a major update! Manual updating is required!"); - return; - } - - SendConsole.info("Getting download link ..."); - Resource premiumResource = updater.getSpigotSiteAPI().getResourceManager() - .getResourceById(resourceId, updater.getSpigotUser()); - - // Download the plugin to the update folder - File pluginFile = null; - try { - pluginFile = new File(URLDecoder.decode( - plugin.getClass().getProtectionDomain().getCodeSource().getLocation().getPath(), - "UTF-8")); - } catch (UnsupportedEncodingException e) { - - } - - File outputFile = null; - try { - outputFile = new File(Bukkit.getUpdateFolderFile(), pluginFile.getName()); - } catch (Exception ex) { - - } - - if (pluginFile != null && outputFile != null) { - SendConsole.info("Downloading '" + plugin.getName() + "' ..."); - premiumResource.downloadResource(updater.getSpigotUser(), outputFile); - - SendConsole.info("An new update for " + plugin.getName() + " is ready to be installed on next restart!"); - } - } - setUpdated(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static boolean isUpdated() { - return updated; - } - - public void setUpdated(boolean updated) { - MVdWUpdaterHook.updated = updated; - } -}