aboutsummaryrefslogtreecommitdiff
path: root/fabric/src
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 /fabric/src
parente9d6a8aa983ac8e3eca7984a774af592b59cc33d (diff)
downloadBBsentials-70dbcacd50bbde0829958599ac0454610a874214.tar.gz
BBsentials-70dbcacd50bbde0829958599ac0454610a874214.tar.bz2
BBsentials-70dbcacd50bbde0829958599ac0454610a874214.zip
things related mojang auth. seems to be broken?
Diffstat (limited to 'fabric/src')
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java5
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java9
-rw-r--r--fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java13
3 files changed, 27 insertions, 0 deletions
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java b/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java
index 5cfcbe3..0b970b4 100644
--- a/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/BBsentialsConfigScreemFactory.java
@@ -67,6 +67,11 @@ public class BBsentialsConfigScreemFactory {
.setTooltip(Text.of("Makes you connect to the Test Server instead of the Main Server. Keep in mind that all announces may be tests and the main announces are not transferred over to here!")) // Optional: Shown when the user hover over this option
.setSaveConsumer(newValue -> BBsentials.config.connectToBeta = newValue)
.build());
+ server.addEntry(entryBuilder.startBooleanToggle(Text.of("Mojang Auth"), BBsentials.config.useMojangAuth)
+ .setDefaultValue(false)
+ .setTooltip(Text.of("Uses mojang as authenticator instead of api key"))
+ .setSaveConsumer(newValue -> BBsentials.config.useMojangAuth = newValue)
+ .build());
server.addEntry(entryBuilder.startBooleanToggle(Text.of("Override Bingo Time"), BBsentials.config.overrideBingoTime)
.setDefaultValue(false)
.setTooltip(Text.of("Override the Bingo Time and connect always to the Server. (Bingo time is 14 days cause Extreme Bingo)"))
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java b/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java
index 1752492..6d5d8d3 100644
--- a/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/DebugThread.java
@@ -3,9 +3,18 @@ package de.hype.bbsentials.fabric;
import java.util.List;
public class DebugThread implements de.hype.bbsentials.common.client.DebugThread {
+ boolean doTest = false;
+
@Override
public void loop() {
+ if (doTest) {
+ doTest = false;
+ test();
+ }
+ }
+ public void doOnce() {
+ doTest = true;
}
@Override
diff --git a/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java
index 149b72a..d3a8ae3 100644
--- a/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java
+++ b/fabric/src/main/java/de/hype/bbsentials/fabric/MCUtils.java
@@ -1,5 +1,6 @@
package de.hype.bbsentials.fabric;
+import com.mojang.authlib.exceptions.AuthenticationException;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.sound.PositionedSoundInstance;
@@ -9,6 +10,8 @@ import net.minecraft.sound.SoundEvent;
import net.minecraft.util.Identifier;
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() {
@@ -32,6 +35,7 @@ public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils {
MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance
.master(SoundEvent.of(new Identifier(eventName)), 1.0F, 1.0F));
}
+
public int getPotTime() {
int remainingDuration = 0;
StatusEffectInstance potTimeRequest = MinecraftClient.getInstance().player.getStatusEffect(StatusEffects.STRENGTH);
@@ -42,4 +46,13 @@ public class MCUtils implements de.hype.bbsentials.common.mclibraries.MCUtils {
}
return remainingDuration;
}
+
+ public String mojangAuth(String serverId) {
+ try {
+ MinecraftClient.getInstance().getSessionService().joinServer(MinecraftClient.getInstance().getGameProfile().getId(), MinecraftClient.getInstance().getSession().getAccessToken(), serverId);
+ } catch (AuthenticationException ignored) {
+ return "";
+ }
+ return serverId;
+ }
}