Working service system
This commit is contained in:
+1
-1
@@ -111,7 +111,7 @@ dependencies {
|
|||||||
// ─────────────────────────────────────────────
|
// ─────────────────────────────────────────────
|
||||||
|
|
||||||
// Session Java (auth/session handling)
|
// Session Java (auth/session handling)
|
||||||
implementation "com.github.selimaj-dev:session-java:0.1.4"
|
implementation "com.github.selimaj-dev:session-java:0.1.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ServiceClient {
|
|||||||
uuid = mcSession.getUuidOrNull();
|
uuid = mcSession.getUuidOrNull();
|
||||||
String username = mcSession.getUsername();
|
String username = mcSession.getUsername();
|
||||||
|
|
||||||
SaturnClient.LOGGER.info("Authenticating with UUID: " + accessToken);
|
SaturnClient.LOGGER.info("Authenticating with UUID: " + uuid);
|
||||||
|
|
||||||
if (!connectTimeout()) {
|
if (!connectTimeout()) {
|
||||||
SaturnClient.LOGGER.error("Unable to authenticate: Session Server Timeout");
|
SaturnClient.LOGGER.error("Unable to authenticate: Session Server Timeout");
|
||||||
@@ -76,7 +76,11 @@ public class ServiceClient {
|
|||||||
|
|
||||||
public static void setCloak(String cloak) {
|
public static void setCloak(String cloak) {
|
||||||
try {
|
try {
|
||||||
session.request(ServiceMethods.SetCloak, cloak).get();
|
session.request(ServiceMethods.SetCloak, cloak).whenComplete((msg, throwable) -> {
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SaturnClient.LOGGER.error("Failed to set cloak (service): ", e);
|
SaturnClient.LOGGER.error("Failed to set cloak (service): ", e);
|
||||||
}
|
}
|
||||||
@@ -84,7 +88,11 @@ public class ServiceClient {
|
|||||||
|
|
||||||
public static void setHat(String hat) {
|
public static void setHat(String hat) {
|
||||||
try {
|
try {
|
||||||
session.request(ServiceMethods.SetHat, hat).get();
|
session.request(ServiceMethods.SetHat, hat).whenComplete((msg, throwable) -> {
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SaturnClient.LOGGER.error("Failed to set hat (service): ", e);
|
SaturnClient.LOGGER.error("Failed to set hat (service): ", e);
|
||||||
}
|
}
|
||||||
@@ -92,7 +100,13 @@ public class ServiceClient {
|
|||||||
|
|
||||||
public static void buyCloak(String cloak) {
|
public static void buyCloak(String cloak) {
|
||||||
try {
|
try {
|
||||||
session.request(ServiceMethods.BuyCloak, cloak).get();
|
session.request(ServiceMethods.BuyCloak, cloak).whenComplete((msg, throwable) -> {
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
} else {
|
||||||
|
Cloaks.availableCloaks.add(cloak);
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SaturnClient.LOGGER.error("Failed to buy cloak (service): ", e);
|
SaturnClient.LOGGER.error("Failed to buy cloak (service): ", e);
|
||||||
}
|
}
|
||||||
@@ -100,7 +114,13 @@ public class ServiceClient {
|
|||||||
|
|
||||||
public static void buyHat(String hat) {
|
public static void buyHat(String hat) {
|
||||||
try {
|
try {
|
||||||
session.request(ServiceMethods.BuyHat, hat).get();
|
session.request(ServiceMethods.BuyHat, hat).whenComplete((msg, throwable) -> {
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
} else {
|
||||||
|
Hats.availableHats.add(hat);
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SaturnClient.LOGGER.error("Failed to buy hat (service): ", e);
|
SaturnClient.LOGGER.error("Failed to buy hat (service): ", e);
|
||||||
}
|
}
|
||||||
@@ -108,7 +128,11 @@ public class ServiceClient {
|
|||||||
|
|
||||||
public static void emote(String emote) {
|
public static void emote(String emote) {
|
||||||
try {
|
try {
|
||||||
session.request(ServiceMethods.Emote, emote).get();
|
session.request(ServiceMethods.Emote, emote).whenComplete((msg, throwable) -> {
|
||||||
|
if (throwable != null) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SaturnClient.LOGGER.error("Failed to emote (service): ", e);
|
SaturnClient.LOGGER.error("Failed to emote (service): ", e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ public class SvgTexture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@SuppressWarnings("resource")
|
|
||||||
public static Identifier getSvg(MinecraftClient client, Identifier svgImage, int width, int height) {
|
public static Identifier getSvg(MinecraftClient client, Identifier svgImage, int width, int height) {
|
||||||
Identifier id = Identifier
|
Identifier id = Identifier
|
||||||
.of(svgImage.toString().replaceAll("\\.svg$", (width + "_" + height).toString() + ".png"));
|
.of(svgImage.toString().replaceAll("\\.svg$", (width + "_" + height).toString() + ".png"));
|
||||||
|
|||||||
Reference in New Issue
Block a user