aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-01-13 19:36:39 +0100
committerGitHub <noreply@github.com>2023-01-13 19:36:39 +0100
commite736097cd2a90c467c84d7fa941aacaea6d5fe7b (patch)
tree7966d98d81af516dac522091fb9473eb80c603b5 /src/main/java/io
parente603cf230af0cef44481633888ec13d2097b6310 (diff)
downloadNotEnoughUpdates-e736097cd2a90c467c84d7fa941aacaea6d5fe7b.tar.gz
NotEnoughUpdates-e736097cd2a90c467c84d7fa941aacaea6d5fe7b.tar.bz2
NotEnoughUpdates-e736097cd2a90c467c84d7fa941aacaea6d5fe7b.zip
Add nopos xdg-open link opener to vanilla GUIs (#542)
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
index b978b433..8baa2bef 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiScreen.java
@@ -20,16 +20,26 @@
package io.github.moulberry.notenoughupdates.mixins;
import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.gui.GuiScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+import java.net.URI;
+
@Mixin(GuiScreen.class)
public class MixinGuiScreen {
@Inject(method = "sendChatMessage(Ljava/lang/String;Z)V", at = @At("HEAD"))
public void onSendChatMessage(String message, boolean addToChat, CallbackInfo ci) {
SBInfo.getInstance().onSendChatMessage(message);
}
+
+ @Inject(method = "openWebLink", at = @At("HEAD"), cancellable = true)
+ public void onOpenWebLink(URI url, CallbackInfo ci) {
+ if (Utils.openUrl(url.toString())) {
+ ci.cancel();
+ }
+ }
}