From 21fa3b25bd2956e5fec89c508bf8ed61fc5cdc06 Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Wed, 14 Dec 2022 07:13:22 +1100 Subject: Fix open in skycrypt button not working on linux with some jdks (#490) --- .../notenoughupdates/commands/help/FeaturesCommand.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java index bc389ad4..bbabc172 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/help/FeaturesCommand.java @@ -29,11 +29,6 @@ import net.minecraft.event.ClickEvent; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; -import java.awt.*; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - public class FeaturesCommand extends ClientCommandBase { public FeaturesCommand() { super("neufeatures"); @@ -48,13 +43,11 @@ public class FeaturesCommand extends ClientCommandBase { } String url = Constants.MISC.get("featureslist").getAsString(); - Desktop desk = Desktop.getDesktop(); - try { - desk.browse(new URI(url)); - Utils.addChatMessage( EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET + - EnumChatFormatting.GOLD + "> Opening Feature List in browser."); - } catch (URISyntaxException | IOException ignored) { - + if (Utils.openUrl(url)) { + Utils.addChatMessage( + EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET + + EnumChatFormatting.GOLD + "> Opening Feature List in browser."); + } else { ChatComponentText clickTextFeatures = new ChatComponentText( EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.BOLD + "NEU" + EnumChatFormatting.RESET + EnumChatFormatting.GOLD + "> Click here to open the Feature List in your browser."); -- cgit