aboutsummaryrefslogtreecommitdiff
path: root/loader/src/main/java/kr
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-08-06 16:59:01 +0900
committersyeyoung <cyoung06@naver.com>2022-08-06 16:59:01 +0900
commit549b20b8a4b08e60bc1deb10076a15e6f839da19 (patch)
treee411936fa132f3e439a2ed19304130bcaf847daa /loader/src/main/java/kr
parent5d16ab7966daf0f813a9d5aebee3cc53826938d6 (diff)
downloadSkyblock-Dungeons-Guide-549b20b8a4b08e60bc1deb10076a15e6f839da19.tar.gz
Skyblock-Dungeons-Guide-549b20b8a4b08e60bc1deb10076a15e6f839da19.tar.bz2
Skyblock-Dungeons-Guide-549b20b8a4b08e60bc1deb10076a15e6f839da19.zip
- Got it to launch minecraft finally
For developers - You need to launch "loader" project, not the "mod" project. - Loom WILL NOT auto-generate launch props. --> Copy contents of build.gradle from other directory to global build.gradle, and run any gradle task to generate. (it was painful to figure out)
Diffstat (limited to 'loader/src/main/java/kr')
-rwxr-xr-xloader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java8
-rwxr-xr-xloader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java5
2 files changed, 9 insertions, 4 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
index 1df59f83..66d7e79b 100755
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
@@ -18,6 +18,8 @@
package kr.syeyoung.dungeonsguide.launcher;
+import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
+import com.mojang.authlib.exceptions.InvalidCredentialsException;
import kr.syeyoung.dungeonsguide.launcher.exceptions.AuthServerException;
import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator;
import kr.syeyoung.dungeonsguide.launcher.branch.ModDownloader;
@@ -54,7 +56,7 @@ public class Main
{
public static final String MOD_ID = "dungeons_guide_wrapper";
public static final String VERSION = "1.0";
- public static final String DOMAIN = "http://testmachine:8080/panel/api";
+ public static final String DOMAIN = "http://testmachine:8080/api";
private static Main main;
@@ -156,6 +158,10 @@ public class Main
} else if (lastError instanceof AuthServerException) {
+ } else if (lastError instanceof InvalidCredentialsException) {
+
+ } else if (lastError instanceof AuthenticationUnavailableException) {
+
} else if (lastError != null){
return new GuiLoadingError(lastError, () -> {lastError = null;});
}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java
index d06e3a39..d16f70ed 100755
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java
@@ -46,7 +46,6 @@ import java.util.concurrent.locks.ReentrantLock;
public class Authenticator {
private String dgAccessToken;
- private Instant validThru;
@Getter
private TokenStatus tokenStatus = TokenStatus.UNAUTHENTICATED;
@@ -55,13 +54,13 @@ public class Authenticator {
private Lock authenticationLock = new ReentrantLock();
static {
- Reflection.registerFieldsToFilter(Authenticator.class, "token"); // Please do not touch this field. I know there is a way to block it completely, but I won't do it here.
+ Reflection.registerFieldsToFilter(Authenticator.class, "dgAccessToken"); // Please do not touch this field. I know there is a way to block it completely, but I won't do it here.
}
public String getRawToken() {
return dgAccessToken;
}
- public String getUnexpiredToken() {
+ public String getUnexpiredToken() { // THIS METHOD MAY BLOCK.
if (tokenStatus != TokenStatus.AUTHENTICATED) throw new IllegalStateException("Token is not available");
long expiry = getJwtPayload(dgAccessToken).getLong("exp");
if (System.currentTimeMillis() >= expiry-2000 || tokenStatus == TokenStatus.EXPIRED) {