Added check if updated project is a Maven one

#32
This commit is contained in:
Norbi Peti 2017-05-31 22:30:23 +02:00
parent 25f770849f
commit ed637dec16
2 changed files with 10 additions and 1 deletions

View file

@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.TBMCCoreAPI;
import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCChatAPI; import buttondevteam.lib.chat.TBMCChatAPI;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;

View file

@ -81,6 +81,16 @@ public class TBMCCoreAPI {
error(sender, "Can't find branch \"" + branch + "\" for plugin \"" + correctname + "\""); error(sender, "Can't find branch \"" + branch + "\" for plugin \"" + correctname + "\"");
return false; 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()); info(sender, "Updating TBMC plugin: " + correctname + " from " + correctbranch.get());
URL url; URL url;
final boolean isWindows = System.getProperty("os.name").contains("Windows"); final boolean isWindows = System.getProperty("os.name").contains("Windows");