From cba81609bd12038559754b07973ec00f598defaa Mon Sep 17 00:00:00 2001 From: Cow Date: Mon, 4 May 2020 02:28:25 +0200 Subject: Bumped version to 1.8.9-0.5.0 - Fixed hardcoded mod-specific strings in some places --- CHANGELOG.md | 7 ++++--- build.gradle | 20 ++++++++++++-------- gradle.properties | 3 ++- .../java/eu/olli/cowmoonication/Cowmoonication.java | 1 + .../eu/olli/cowmoonication/command/MooCommand.java | 6 +++--- .../java/eu/olli/cowmoonication/util/ApiUtils.java | 2 +- .../eu/olli/cowmoonication/util/VersionChecker.java | 12 ++++++------ src/main/resources/mcmod.info | 2 +- update.json | 6 +++--- update_template.json | 4 ++-- 10 files changed, 35 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e12270c..395a921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [1.8.9-0.5.0] - unreleased +## [1.8.9-0.5.0] - 04.05.2020 ### Added - Added Tab-completable usernames for several commands (e.g. party, msg, boop, ...) - the list of supported commands can be modified via `/moo config` → `Commands with Tab-completable usernames` @@ -13,7 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Improved player stalking feature: - now includes 'offline for <duration>' - better handling of special cases (e.g. nicked players, players who haven't joined in years) -- Various Code refactorings +- Various code refactorings ## [1.8.9-0.4.0] - 18.04.2020 ### Added @@ -65,7 +65,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). *Note:* The 'best friends' list is currently available via ESC > Mod Options > Cowmoonication > Config > bestFriends. -[1.8.9-0.5.0]: https://github.com/cow-mc/Cowmoonication/compare/v1.8.9-0.4.0...master + +[1.8.9-0.5.0]: https://github.com/cow-mc/Cowmoonication/compare/v1.8.9-0.4.0...v1.8.9-0.5.0 [1.8.9-0.4.0]: https://github.com/cow-mc/Cowmoonication/compare/v1.8.9-0.3.1...v1.8.9-0.4.0 [1.8.9-0.3.1]: https://github.com/cow-mc/Cowmoonication/compare/v1.8.9-0.3.0...v1.8.9-0.3.1 [1.8.9-0.3.0]: https://github.com/cow-mc/Cowmoonication/compare/v1.8.9-0.2.0...v1.8.9-0.3.0 diff --git a/build.gradle b/build.gradle index 904befd..cbd91b2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,3 @@ - // For those who want the bleeding edge buildscript { repositories { @@ -22,7 +21,9 @@ plugins { */ version = "${mc_version}-${mod_version}" group = project.group_package // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = project.mod_name +def mod_name_no_spaces = project.mod_name.replace(" ", "") +def mod_id = mod_name_no_spaces.toLowerCase() +archivesBaseName = mod_name_no_spaces sourceCompatibility = 1.8 targetCompatibility = 1.8 @@ -32,8 +33,8 @@ minecraft { version = "${mc_version}-${forge_version}" runDir = "run" - replace "@VERSION@": project.version, "@MODNAME@": project.archivesBaseName, "@MODID@": project.archivesBaseName.toLowerCase(), "@PACKAGE@": project.group_package - replaceIn "${mod_name}.java" + replace "@VERSION@": project.version, "@MODNAME@": project.mod_name, "@MODID@": mod_id, "@PACKAGE@": project.group_package, "@GITURL@": project.git_url + replaceIn "${mod_name_no_spaces}.java" // the mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD snapshot are built nightly. @@ -72,13 +73,16 @@ processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version + inputs.property "modname", project.mod_name + inputs.property "modid", mod_id + inputs.property "giturl", project.git_url // replace stuff in mcmod.info, but nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - - // replace version, mcversion, modname and modid - expand 'version':project.version, 'mcversion':project.minecraft.version, 'modname':project.archivesBaseName, 'modid':project.archivesBaseName.toLowerCase() + + // replace version, mcversion, modname, modid and giturl + expand 'version':project.version, 'mcversion':project.minecraft.version, 'modname':project.mod_name, 'modid':mod_id, 'giturl':project.git_url } // copy everything else, that's not the mcmod.info @@ -93,6 +97,6 @@ copy { from file('update_template.json') into projectDir rename { 'update.json' } - expand(mcversion: project.minecraft.version, version: project.version) + expand(mcversion: project.minecraft.version, version: project.version, giturl: project.git_url) filter(FixCrLfFilter) } diff --git a/gradle.properties b/gradle.properties index cf7a2eb..34fe5b5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,7 @@ mod_name=Cowmoonication group_package=eu.olli.cowmoonication -mod_version=0.4.0 +mod_version=0.5.0 +git_url=https://github.com/cow-mc/Cowmoonication/ mc_version=1.8.9 forge_version=11.15.1.2318-1.8.9 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": "", diff --git a/update.json b/update.json index 086050e..0c66c1e 100644 --- a/update.json +++ b/update.json @@ -1,10 +1,10 @@ { "homepage": "https://github.com/cow-mc/Cowmoonication/", "1.8.9": { - "1.8.9-0.4.0": "https://github.com/cow-mc/Cowmoonication/blob/master/CHANGELOG.md" + "1.8.9-0.5.0": "https://github.com/cow-mc/Cowmoonication/blob/master/CHANGELOG.md" }, "promos": { - "1.8.9-latest": "1.8.9-0.4.0", - "1.8.9-recommended": "1.8.9-0.4.0" + "1.8.9-latest": "1.8.9-0.5.0", + "1.8.9-recommended": "1.8.9-0.5.0" } } diff --git a/update_template.json b/update_template.json index 4435a6d..21bdb57 100644 --- a/update_template.json +++ b/update_template.json @@ -1,7 +1,7 @@ { - "homepage": "https://github.com/cow-mc/Cowmoonication/", + "homepage": "${giturl}", "${mcversion}": { - "${version}": "https://github.com/cow-mc/Cowmoonication/blob/master/CHANGELOG.md" + "${version}": "${giturl}blob/master/CHANGELOG.md" }, "promos": { "${mcversion}-latest": "${version}", -- cgit