aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-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();
+ }
+ }
}