From 67bca7bcd75bbae20961bebc2d688e9f31b560e9 Mon Sep 17 00:00:00 2001 From: Pyrofab Date: Mon, 1 Jan 2024 23:55:01 +0100 Subject: [PATCH] Add debug helper to login in dev env --- .../impersonatest/ImpersonatestClient.java | 35 +++++++++++++++++++ src/testmod/resources/fabric.mod.json | 3 ++ 2 files changed, 38 insertions(+) create mode 100644 src/testmod/java/io/github/ladysnake/impersonatest/ImpersonatestClient.java diff --git a/src/testmod/java/io/github/ladysnake/impersonatest/ImpersonatestClient.java b/src/testmod/java/io/github/ladysnake/impersonatest/ImpersonatestClient.java new file mode 100644 index 0000000..874c8bd --- /dev/null +++ b/src/testmod/java/io/github/ladysnake/impersonatest/ImpersonatestClient.java @@ -0,0 +1,35 @@ +/* + * Impersonate + * Copyright (C) 2020-2024 Ladysnake + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; If not, see . + */ +package io.github.ladysnake.impersonatest; + +import io.github.ladysnake.impersonate.Impersonate; +import net.fabricmc.api.ClientModInitializer; +import net.minecraft.client.MinecraftClient; + +public final class ImpersonatestClient implements ClientModInitializer { + private static final boolean debugCredentials = Boolean.getBoolean("impersonate.debug.printCredentials"); + + @Override + public void onInitializeClient() { + if (debugCredentials) { + // Here to help login within a dev environment - be very careful when running this code at home + Impersonate.LOGGER.info("ACCESS_TOKEN " + MinecraftClient.getInstance().getSession().getAccessToken()); + Impersonate.LOGGER.info("UUID " + MinecraftClient.getInstance().getSession().getUuidOrNull()); + } + } +} diff --git a/src/testmod/resources/fabric.mod.json b/src/testmod/resources/fabric.mod.json index 8fd3268..f8d6473 100644 --- a/src/testmod/resources/fabric.mod.json +++ b/src/testmod/resources/fabric.mod.json @@ -18,6 +18,9 @@ "main": [ "io.github.ladysnake.impersonatest.Impersonatest" ], + "client": [ + "io.github.ladysnake.impersonatest.ImpersonatestClient" + ], "fabric-gametest": [ "io.github.ladysnake.impersonatest.ImpersonateTestSuite" ]