From ed637dec167d337645ab1e0a3c80a907b62e0f90 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Wed, 31 May 2017 22:30:23 +0200 Subject: [PATCH] Added check if updated project is a Maven one #32 --- src/main/java/buttondevteam/core/CommandCaller.java | 1 - src/main/java/buttondevteam/lib/TBMCCoreAPI.java | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/buttondevteam/core/CommandCaller.java b/src/main/java/buttondevteam/core/CommandCaller.java index 688dd0d..26b0c47 100644 --- a/src/main/java/buttondevteam/core/CommandCaller.java +++ b/src/main/java/buttondevteam/core/CommandCaller.java @@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.PluginCommand; import org.bukkit.plugin.java.JavaPlugin; import buttondevteam.lib.TBMCCoreAPI; -import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCCommandBase; diff --git a/src/main/java/buttondevteam/lib/TBMCCoreAPI.java b/src/main/java/buttondevteam/lib/TBMCCoreAPI.java index a80923c..217443c 100644 --- a/src/main/java/buttondevteam/lib/TBMCCoreAPI.java +++ b/src/main/java/buttondevteam/lib/TBMCCoreAPI.java @@ -81,6 +81,16 @@ public class TBMCCoreAPI { error(sender, "Can't find branch \"" + branch + "\" for plugin \"" + correctname + "\""); return false; } + try { + if (DownloadString("https://raw.githubusercontent.com/TBMCPlugins/" + correctname + "/" + + correctbranch.get() + "/pom.xml").equals("404: Not Found\n")) { + error(sender, "The plugin doesn't appear to have a pom.xml. Make sure it's a Maven project."); + return false; + } + } catch (IOException e1) { + error(sender, "The plugin doesn't appear to have a pom.xml. Make sure it's a Maven project.\n" + e1); + return false; + } info(sender, "Updating TBMC plugin: " + correctname + " from " + correctbranch.get()); URL url; final boolean isWindows = System.getProperty("os.name").contains("Windows");