From 96eda0751f26e81d8788d62264dc74dd28358d66 Mon Sep 17 00:00:00 2001 From: Äkwav <16632490+Ekwav@users.noreply.github.com> Date: Sun, 26 Feb 2023 17:01:07 +0100 Subject: fixed location, patched purse commands (#93) * fixed location, patched purse commands * revert chat format * revert overlooked line * bump session length --- .../minecraft_integration/CoflSessionManager.java | 2 +- .../minecraft_integration/PlayerDataProvider.java | 28 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src/main/java/de/torui/coflsky/minecraft_integration') diff --git a/src/main/java/de/torui/coflsky/minecraft_integration/CoflSessionManager.java b/src/main/java/de/torui/coflsky/minecraft_integration/CoflSessionManager.java index cab0c15..9a4edea 100644 --- a/src/main/java/de/torui/coflsky/minecraft_integration/CoflSessionManager.java +++ b/src/main/java/de/torui/coflsky/minecraft_integration/CoflSessionManager.java @@ -86,7 +86,7 @@ public class CoflSessionManager { } public static boolean isValidSession(CoflSession session) { - if(session.timestampCreated.plus(Duration.ofDays(14)).isAfter(ZonedDateTime.now())) { + if(session.timestampCreated.plus(Duration.ofDays(180)).isAfter(ZonedDateTime.now())) { return true; } return false; diff --git a/src/main/java/de/torui/coflsky/minecraft_integration/PlayerDataProvider.java b/src/main/java/de/torui/coflsky/minecraft_integration/PlayerDataProvider.java index ede60ce..352aded 100644 --- a/src/main/java/de/torui/coflsky/minecraft_integration/PlayerDataProvider.java +++ b/src/main/java/de/torui/coflsky/minecraft_integration/PlayerDataProvider.java @@ -14,10 +14,20 @@ import net.minecraft.client.Minecraft; public class PlayerDataProvider { - private static class UUIDHelper { - public String id; - public String name; - } + private static class UUIDHelper { + public String id; + public String name; + } + + public static class PlayerPosition + { + public double X; + public double Y; + public double Z; + public float Yaw; + public float Pitch; + + } public static String getActivePlayerUUID() { try { @@ -65,5 +75,15 @@ public class PlayerDataProvider { String username = Minecraft.getSessionInfo().get("X-Minecraft-Username"); return username; } + + public static PlayerPosition getPlayerPosition() { + PlayerPosition pos = new PlayerPosition(); + pos.X = Minecraft.getMinecraft().thePlayer.posX; + pos.Y = Minecraft.getMinecraft().thePlayer.posY; + pos.Z = Minecraft.getMinecraft().thePlayer.posZ; + pos.Yaw = Minecraft.getMinecraft().thePlayer.rotationYaw; + pos.Pitch = Minecraft.getMinecraft().thePlayer.rotationPitch; + return pos; + } } -- cgit