diff options
Diffstat (limited to 'src/main')
5 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/eu/olli/cowmoonication/Cowmoonication.java b/src/main/java/eu/olli/cowmoonication/Cowmoonication.java index e106fcd..e44ab23 100644 --- a/src/main/java/eu/olli/cowmoonication/Cowmoonication.java +++ b/src/main/java/eu/olli/cowmoonication/Cowmoonication.java @@ -30,6 +30,7 @@ public class Cowmoonication { public static final String MODID = "@MODID@"; public static final String VERSION = "@VERSION@"; public static final String MODNAME = "@MODNAME@"; + public static final String GITURL = "@GITURL@"; private File modsDir; private MooConfig config; private Friends friends; diff --git a/src/main/java/eu/olli/cowmoonication/command/MooCommand.java b/src/main/java/eu/olli/cowmoonication/command/MooCommand.java index 9cf94e1..c0a822b 100644 --- a/src/main/java/eu/olli/cowmoonication/command/MooCommand.java +++ b/src/main/java/eu/olli/cowmoonication/command/MooCommand.java @@ -90,13 +90,13 @@ public class MooCommand extends CommandBase { main.getChatHelper().sendMessage(new ChatComponentText("\u279C Update instructions:").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(true)) .appendSibling(new ChatComponentText("\n\u278A" + EnumChatFormatting.YELLOW + " download latest mod version").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(false) .setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, main.getVersionChecker().getDownloadUrl())) - .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW + "Download the latest version of Cowmoonication\n\u279C Click to download latest mod file"))))) + .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW + "Download the latest version of " + Cowmoonication.MODNAME + "\n\u279C Click to download latest mod file"))))) .appendSibling(new ChatComponentText("\n\u278B" + EnumChatFormatting.YELLOW + " exit Minecraft").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(false) .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.GOLD + "\u278B" + EnumChatFormatting.YELLOW + " Without closing Minecraft first,\n" + EnumChatFormatting.YELLOW + "you can't delete the old .jar file!"))))) - .appendSibling(new ChatComponentText("\n\u278C" + EnumChatFormatting.YELLOW + " copy " + EnumChatFormatting.GOLD + "Cowmoonication-" + main.getVersionChecker().getNewVersion() + ".jar" + EnumChatFormatting.YELLOW + " into mods folder").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(false) + .appendSibling(new ChatComponentText("\n\u278C" + EnumChatFormatting.YELLOW + " copy " + EnumChatFormatting.GOLD + Cowmoonication.MODNAME.replace(" ", "") + "-" + main.getVersionChecker().getNewVersion() + ".jar" + EnumChatFormatting.YELLOW + " into mods folder").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(false) .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/moo folder")) .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW + "Open mods folder with command " + EnumChatFormatting.GOLD + "/moo folder\n\u279C Click to open mods folder"))))) - .appendSibling(new ChatComponentText("\n\u278D" + EnumChatFormatting.YELLOW + " delete old mod file " + EnumChatFormatting.GOLD + "Cowmoonication-" + Cowmoonication.VERSION + ".jar ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(false))) + .appendSibling(new ChatComponentText("\n\u278D" + EnumChatFormatting.YELLOW + " delete old mod file " + EnumChatFormatting.GOLD + Cowmoonication.MODNAME.replace(" ", "") + "-" + Cowmoonication.VERSION + ".jar ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(false))) .appendSibling(new ChatComponentText("\n\u278E" + EnumChatFormatting.YELLOW + " start Minecraft again").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GOLD).setBold(false)))); } else if (args[0].equalsIgnoreCase("version")) { main.getVersionChecker().handleVersionStatus(true); diff --git a/src/main/java/eu/olli/cowmoonication/util/ApiUtils.java b/src/main/java/eu/olli/cowmoonication/util/ApiUtils.java index 650c56d..9f013f3 100644 --- a/src/main/java/eu/olli/cowmoonication/util/ApiUtils.java +++ b/src/main/java/eu/olli/cowmoonication/util/ApiUtils.java @@ -103,7 +103,7 @@ public class ApiUtils { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.setConnectTimeout(5000); connection.setReadTimeout(5000); - connection.addRequestProperty("User-Agent", "Forge Mod " + Cowmoonication.MODNAME + "/" + Cowmoonication.VERSION + " (https://github.com/cow-mc/Cowmoonication/)"); + connection.addRequestProperty("User-Agent", "Forge Mod " + Cowmoonication.MODNAME + "/" + Cowmoonication.VERSION + " (" + Cowmoonication.GITURL + ")"); connection.getResponseCode(); if (connection.getResponseCode() == 204) { diff --git a/src/main/java/eu/olli/cowmoonication/util/VersionChecker.java b/src/main/java/eu/olli/cowmoonication/util/VersionChecker.java index fa04c38..1b7503e 100644 --- a/src/main/java/eu/olli/cowmoonication/util/VersionChecker.java +++ b/src/main/java/eu/olli/cowmoonication/util/VersionChecker.java @@ -23,7 +23,7 @@ public class VersionChecker { * Cooldown between to update checks in minutes */ private static final int CHECK_COOLDOWN = 15; - private static final String CHANGELOG_URL = "https://github.com/cow-mc/Cowmoonication/blob/master/CHANGELOG.md"; + private static final String CHANGELOG_URL = Cowmoonication.GITURL + "blob/master/CHANGELOG.md"; private final Cowmoonication main; private long lastCheck; private String newVersion; @@ -33,7 +33,7 @@ public class VersionChecker { this.main = main; this.lastCheck = Minecraft.getSystemTime(); newVersion = "[newVersion]"; - downloadUrl = "https://github.com/cow-mc/Cowmoonication/releases"; + downloadUrl = Cowmoonication.GITURL + "releases"; } public boolean runUpdateCheck(boolean isCommandTriggered) { @@ -42,7 +42,7 @@ public class VersionChecker { long now = Minecraft.getSystemTime(); - // only re-run if last check was >CHECK_COOLDOWN minutes ago# + // only re-run if last check was >CHECK_COOLDOWN minutes ago if (getNextCheck() < 0) { // next allowed check is "in the past", so we're good to go lastCheck = now; ForgeVersion.startVersionCheck(); @@ -61,7 +61,7 @@ public class VersionChecker { ForgeVersion.CheckResult versionResult = ForgeVersion.getResult(Loader.instance().activeModContainer()); if (versionResult.target != null) { newVersion = versionResult.target.toString(); - downloadUrl = "https://github.com/cow-mc/Cowmoonication/releases/download/v" + newVersion + "/" + Cowmoonication.MODNAME + "-" + newVersion + ".jar"; + downloadUrl = Cowmoonication.GITURL + "releases/download/v" + newVersion + "/" + Cowmoonication.MODNAME.replace(" ", "") + "-" + newVersion + ".jar"; } IChatComponent statusMsg = null; @@ -94,12 +94,12 @@ public class VersionChecker { // outdated IChatComponent spacer = new ChatComponentText(" ").setChatStyle(new ChatStyle().setParentStyle(null)); - IChatComponent text = new ChatComponentText("\u279C New version of " + EnumChatFormatting.DARK_GREEN + "Cowmoonication " + EnumChatFormatting.GREEN + "available (" + Cowmoonication.VERSION + " \u27A1 " + newVersion + ")\n").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)); + IChatComponent text = new ChatComponentText("\u279C New version of " + EnumChatFormatting.DARK_GREEN + Cowmoonication.MODNAME + " " + EnumChatFormatting.GREEN + "available (" + Cowmoonication.VERSION + " \u27A1 " + newVersion + ")\n").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GREEN)); IChatComponent download = new ChatComponentText("[Download]").setChatStyle(new ChatStyle() .setColor(EnumChatFormatting.DARK_GREEN).setBold(true) .setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, downloadUrl)) - .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW + "Download the latest version of Cowmoonication")))); + .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW + "Download the latest version of " + Cowmoonication.MODNAME)))); IChatComponent changelog = new ChatComponentText("[Changelog]").setChatStyle(new ChatStyle() .setColor(EnumChatFormatting.DARK_AQUA).setBold(true) diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f833024..bbd28d9 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -4,7 +4,7 @@ "description": "Adding various things related to communication.", "version": "${version}", "mcversion": "${mcversion}", - "url": "https://github.com/cow-mc/Cowmoonication/", + "url": "${giturl}", "updateUrl": "https://raw.githubusercontent.com/cow-mc/Cowmoonication/master/update.json", "authorList": ["Cow"], "logoFile": "", |