Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Update project to 2024.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldieeins committed Feb 2, 2024
1 parent e4b3c7c commit 608c467
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>live.nerotv</groupId>
<artifactId>ZyneonAuth</artifactId>
<version>2024.2.1</version>
<version>2024.2.2</version>
<packaging>jar</packaging>

<name>ZyneonAuth</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,25 @@ public class MinecraftMSLiveAuthProcess extends ProcessDetails {

private final static Integer loginTimeoutInSeconds = 300;

ServerHelper helper;

public ServerHelper getServer() {
if(helper==null) {
helper = new ServerHelper();
}
return helper;
}

public void setServer(ServerHelper helper) {
this.helper = helper;
}

@Override
@SuppressWarnings("all")
public HashMap<String, String> login() {
ServerHelper helper = new ServerHelper();
if(helper==null) {
helper = new ServerHelper();
}

new Thread(() -> {
try {
Expand Down Expand Up @@ -216,7 +231,9 @@ public HashMap<String, String> relogin(String refreshToken) {

String accessToken;

ServerHelper helper = new ServerHelper();
if(helper!=null) {
helper = new ServerHelper();
}
helper.startServerHeadless(local_port);

HttpURLConnection conn = (HttpURLConnection) new URI("https://login.live.com/oauth20_token.srf").toURL().openConnection();
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/live/nerotv/zyneon/auth/ZyneonAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ public static HashMap<AuthInfo,String> getAuthInfos() {
HashMap<AuthInfo,String> map = new HashMap<>();
try {
//AUTHENTICATE AND RETURN DATA
HashMap<String, String> authData = new AuthProcess().startAuthProcess(new MinecraftMSLiveAuthProcess());
MinecraftMSLiveAuthProcess process = new MinecraftMSLiveAuthProcess();
HashMap<String, String> authData = new AuthProcess().startAuthProcess(process);

//ADDING DATA FROM AUTH DATA TO MAP
map.put(AuthInfo.ACCESS_TOKEN,authData.get("minecraft_token"));
map.put(AuthInfo.REFRESH_TOKEN,authData.get("ms_refresh_token"));
map.put(AuthInfo.USERNAME,authData.get("username"));
map.put(AuthInfo.UUID,authData.get("uuid"));

process.getServer().stopServer();
process.setServer(null);
System.gc();
} catch (Exception e) {
//RETURNING NULL IF ERROR
return null;
Expand All @@ -32,13 +37,18 @@ public static HashMap<AuthInfo,String> getAuthInfos(String refreshToken) {
HashMap<AuthInfo,String> map = new HashMap<>();
try {
//AUTHENTICATE AND RETURN DATA
HashMap<String, String> authData = new AuthProcess().reAuth(new MinecraftMSLiveAuthProcess(), refreshToken);
MinecraftMSLiveAuthProcess process = new MinecraftMSLiveAuthProcess();
HashMap<String, String> authData = new AuthProcess().reAuth(process, refreshToken);

//ADDING DATA FROM AUTH DATA TO MAP
map.put(AuthInfo.ACCESS_TOKEN,authData.get("minecraft_token"));
map.put(AuthInfo.REFRESH_TOKEN,authData.get("ms_refresh_token"));
map.put(AuthInfo.USERNAME,authData.get("username"));
map.put(AuthInfo.UUID,authData.get("uuid"));

process.getServer().stopServer();
process.setServer(null);
System.gc();
} catch (Exception e) {
//RETURNING NULL IF ERROR
return null;
Expand Down

0 comments on commit 608c467

Please sign in to comment.