From 70dbcacd50bbde0829958599ac0454610a874214 Mon Sep 17 00:00:00 2001 From: hackthetime Date: Mon, 16 Oct 2023 21:03:20 +0200 Subject: things related mojang auth. seems to be broken? --- .../src/main/java/de/hype/bbsentials/forge/MCUtils.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'forge/src/main/java/de/hype') diff --git a/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java b/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java index a9334d5..424eded 100644 --- a/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java +++ b/forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java @@ -1,5 +1,6 @@ package de.hype.bbsentials.forge; +import com.mojang.authlib.exceptions.AuthenticationException; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.potion.Potion; @@ -8,6 +9,8 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.Display; import java.io.File; +import java.math.BigInteger; +import java.util.Random; public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils { public boolean isWindowFocused() { @@ -41,4 +44,18 @@ public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils { } return remainingDuration; } + + + public String mojangAuth(String serverId) { + try { + Minecraft.getMinecraft().getSessionService().joinServer(Minecraft + .getMinecraft() + .getSession() + .getProfile(), Minecraft.getMinecraft().getSession().getToken(), serverId); + } catch (AuthenticationException e) { + return null; + } + return serverId; + } + } -- cgit