aboutsummaryrefslogtreecommitdiff
path: root/forge/src/main
diff options
context:
space:
mode:
authorhackthetime <l4bg0jb7@duck.com>2023-10-16 21:03:20 +0200
committerhackthetime <l4bg0jb7@duck.com>2023-10-16 21:03:20 +0200
commit70dbcacd50bbde0829958599ac0454610a874214 (patch)
tree2ec8c427449fa84df38aba9f55000b24ea768211 /forge/src/main
parente9d6a8aa983ac8e3eca7984a774af592b59cc33d (diff)
downloadBBsentials-70dbcacd50bbde0829958599ac0454610a874214.tar.gz
BBsentials-70dbcacd50bbde0829958599ac0454610a874214.tar.bz2
BBsentials-70dbcacd50bbde0829958599ac0454610a874214.zip
things related mojang auth. seems to be broken?
Diffstat (limited to 'forge/src/main')
-rw-r--r--forge/src/main/java/de/hype/bbsentials/forge/MCUtils.java17
1 files changed, 17 insertions, 0 deletions
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;
+ }
+
}