diff options
author | Äkwav <16632490+Ekwav@users.noreply.github.com> | 2021-11-05 23:26:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 23:26:27 +0100 |
commit | e7ad35aec14bc4804762843948973fc4af687c04 (patch) | |
tree | 7fe6a9fa5040a0fada33a93720fd29a5cbac5206 /src/main/java/de/torui/coflsky/network | |
parent | 52bc80f092c0ea58063008d2257b4e6f52f4b272 (diff) | |
parent | 7c1eb7049159f0011f138c02788b2b630f5480a1 (diff) | |
download | COFL-e7ad35aec14bc4804762843948973fc4af687c04.tar.gz COFL-e7ad35aec14bc4804762843948973fc4af687c04.tar.bz2 COFL-e7ad35aec14bc4804762843948973fc4af687c04.zip |
Merge pull request #34 from Coflnet/fix/graceful-fail
Handle Fail more graceful
Diffstat (limited to 'src/main/java/de/torui/coflsky/network')
-rw-r--r-- | src/main/java/de/torui/coflsky/network/WSClientWrapper.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/de/torui/coflsky/network/WSClientWrapper.java b/src/main/java/de/torui/coflsky/network/WSClientWrapper.java index 6542542..044dd65 100644 --- a/src/main/java/de/torui/coflsky/network/WSClientWrapper.java +++ b/src/main/java/de/torui/coflsky/network/WSClientWrapper.java @@ -13,7 +13,11 @@ import de.torui.coflsky.commands.Command; import de.torui.coflsky.commands.JsonStringCommand; import de.torui.coflsky.minecraft_integration.PlayerDataProvider; import net.minecraft.client.Minecraft; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.ClickEvent.Action; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; import de.torui.coflsky.minecraft_integration.CoflSessionManager; @@ -63,7 +67,19 @@ public class WSClientWrapper { } } - throw new Error("Could not connect to any websocket remote!"); + Minecraft.getMinecraft().thePlayer.addChatMessage( + new ChatComponentText("Cofl could not establish a connection to any server!"+ + "\nIf you think this is a bug. Please report it on our Discord and include the ") + .setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)) + .appendSibling(new ChatComponentText("logs!") + .setChatStyle(new ChatStyle() + .setUnderlined(true) + .setColor(EnumChatFormatting.BLUE) + .setChatClickEvent(new ClickEvent(Action.OPEN_URL, "https://www.youtube.com/watch?v=9Kb29wEcMcs"))))); + + return false; + //throw new Error("Could not connect to any websocket remote!"); + } |