Compare commits
3
Commits
1.2.17
...
939ed09bdb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
939ed09bdb | ||
|
|
8417fd7b45 | ||
|
|
60e624e47e |
No files matched your search
+3
-3
@@ -3,7 +3,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'me.creepermaxcz.mc-bots'
|
group 'me.creepermaxcz.mc-bots'
|
||||||
version '1.2.17'
|
version '1.2.18'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -13,7 +13,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.geysermc.mcprotocollib:protocol:1.21.7-SNAPSHOT'
|
implementation 'org.geysermc.mcprotocollib:protocol:1.21.11-SNAPSHOT'
|
||||||
implementation 'net.kyori:adventure-text-serializer-gson:4.24.0'
|
implementation 'net.kyori:adventure-text-serializer-gson:4.24.0'
|
||||||
implementation 'commons-cli:commons-cli:1.9.0'
|
implementation 'commons-cli:commons-cli:1.9.0'
|
||||||
implementation 'com.diogonunes:JColor:5.5.1'
|
implementation 'com.diogonunes:JColor:5.5.1'
|
||||||
@@ -24,7 +24,7 @@ dependencies {
|
|||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package me.creepermaxcz.mcbots;
|
|||||||
|
|
||||||
import net.lenni0451.commons.httpclient.HttpClient;
|
import net.lenni0451.commons.httpclient.HttpClient;
|
||||||
import net.raphimc.minecraftauth.MinecraftAuth;
|
import net.raphimc.minecraftauth.MinecraftAuth;
|
||||||
import net.raphimc.minecraftauth.step.java.session.StepFullJavaSession;
|
import net.raphimc.minecraftauth.java.JavaAuthManager;
|
||||||
import net.raphimc.minecraftauth.step.msa.StepMsaDeviceCode;
|
import net.raphimc.minecraftauth.java.model.MinecraftProfile;
|
||||||
|
import net.raphimc.minecraftauth.msa.model.MsaDeviceCode;
|
||||||
|
import net.raphimc.minecraftauth.msa.service.impl.DeviceCodeMsaAuthService;
|
||||||
import org.geysermc.mcprotocollib.auth.GameProfile;
|
import org.geysermc.mcprotocollib.auth.GameProfile;
|
||||||
import org.geysermc.mcprotocollib.network.ProxyInfo;
|
import org.geysermc.mcprotocollib.network.ProxyInfo;
|
||||||
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
|
||||||
@@ -23,6 +25,7 @@ import java.io.*;
|
|||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -277,18 +280,17 @@ public class Main {
|
|||||||
botCount = 1;
|
botCount = 1;
|
||||||
|
|
||||||
HttpClient httpClient = MinecraftAuth.createHttpClient();
|
HttpClient httpClient = MinecraftAuth.createHttpClient();
|
||||||
StepFullJavaSession.FullJavaSession javaSession =
|
JavaAuthManager authManager = JavaAuthManager.create(httpClient)
|
||||||
MinecraftAuth.JAVA_DEVICE_CODE_LOGIN.getFromInput(
|
.login(DeviceCodeMsaAuthService::new, (Consumer<MsaDeviceCode>) msaDeviceCode -> {
|
||||||
httpClient, new StepMsaDeviceCode.MsaDeviceCodeCallback(
|
|
||||||
msaDeviceCode -> {
|
|
||||||
Log.info("Authorize your Microsoft account on " + msaDeviceCode.getDirectVerificationUri());
|
Log.info("Authorize your Microsoft account on " + msaDeviceCode.getDirectVerificationUri());
|
||||||
Log.info("Waiting for authorization.");
|
Log.info("Waiting for authorization.");
|
||||||
}));
|
});
|
||||||
|
|
||||||
Log.info("Logged in with username: " + javaSession.getMcProfile().getName());
|
MinecraftProfile mcProfile = authManager.getMinecraftProfile().getUpToDate();
|
||||||
|
Log.info("Logged in with username: " + mcProfile.getName());
|
||||||
|
|
||||||
GameProfile gameProfile = new GameProfile(javaSession.getMcProfile().getId(), javaSession.getMcProfile().getName());
|
GameProfile gameProfile = new GameProfile(mcProfile.getId(), mcProfile.getName());
|
||||||
protocol = new MinecraftProtocol(gameProfile, javaSession.getMcProfile().getMcToken().getAccessToken());
|
protocol = new MinecraftProtocol(gameProfile, authManager.getMinecraftToken().getUpToDate().getToken());
|
||||||
} else {
|
} else {
|
||||||
protocol = null;
|
protocol = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user