Skip to content

Commit eeafc71

Browse files
committed
Update the URL to the new MC snapshot format.
Signed-off-by: KiriCattus <[email protected]>
1 parent 6ea5855 commit eeafc71

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/commander/java/com/mcmoddev/mmdbot/commander/updatenotifiers/minecraft/MinecraftUpdateNotifier.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,19 @@ protected EmbedBuilder getEmbed(@Nullable final VersionsInfo oldVersion, final @
8888
.formatted(split[0].replace('.', '-'), split[1].substring(3)));
8989
embed.setColor(Color.ORANGE);
9090
} else {
91-
// https://www.minecraft.net/en-us/article/minecraft-snapshot-23w07a
91+
// old snapshot url format https://www.minecraft.net/en-us/article/minecraft-snapshot-23w07a
92+
// new snapshot url format https://www.minecraft.net/en-us/article/minecraft-1-26-snapshot-5
9293
embed.setTitle("New Minecraft snapshot available!");
93-
embed.setDescription(newVersion.snapshot() + "\nChangelog: " + "https://www.minecraft.net/en-us/article/minecraft-snapshot-%s".formatted(newVersion.snapshot()));
94+
final String snapshot = newVersion.snapshot();
95+
final String changelogUrl;
96+
if (snapshot.contains("snapshot")) {
97+
// new format already includes 'snapshot' and the version prefix
98+
changelogUrl = "https://www.minecraft.net/en-us/article/minecraft-%s".formatted(snapshot);
99+
} else {
100+
// old format like '23w07a'
101+
changelogUrl = "https://www.minecraft.net/en-us/article/minecraft-snapshot-%s".formatted(snapshot);
102+
}
103+
embed.setDescription(snapshot + "\nChangelog: " + changelogUrl);
94104
embed.setColor(Color.CYAN);
95105
}
96106
}

0 commit comments

Comments
 (0)