From bddc37d490a5ae41319c0ca2e852b30bd0d24abf Mon Sep 17 00:00:00 2001 From: Wide_Cat Date: Thu, 5 Sep 2024 15:08:15 +0100 Subject: [PATCH] remove EasyMC from account manager because they shut down --- .../screens/accounts/AccountInfoScreen.java | 6 +- .../gui/screens/accounts/AccountsScreen.java | 1 - .../accounts/AddEasyMCAccountScreen.java | 38 ------- .../systems/accounts/AccountType.java | 3 +- .../systems/accounts/Accounts.java | 2 - .../systems/accounts/types/EasyMCAccount.java | 99 ------------------- 6 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AddEasyMCAccountScreen.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java index e81bb64dc1..19d5ab57b6 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountInfoScreen.java @@ -28,11 +28,11 @@ public AccountInfoScreen(GuiTheme theme, Account account) { public void initWidgets() { TokenAccount e = (TokenAccount) account; WHorizontalList l = add(theme.horizontalList()).expandX().widget(); - + WButton copy = theme.button("Copy"); copy.action = () -> mc.keyboard.setClipboard(e.getToken()); - - l.add(theme.label((account.getType() == AccountType.EasyMC ? "EasyMC" : "TheAltening") + " token")); + + l.add(theme.label("TheAltening token:")); l.add(theme.label(e.getToken()).color(Color.GRAY)).pad(5); l.add(copy); } diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountsScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountsScreen.java index 1791240580..2daf1e052f 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountsScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AccountsScreen.java @@ -37,7 +37,6 @@ public void initWidgets() { addButton(l, "Cracked", () -> mc.setScreen(new AddCrackedAccountScreen(theme, this))); addButton(l, "Altening", () -> mc.setScreen(new AddAlteningAccountScreen(theme, this))); - addButton(l, "EasyMC", () -> mc.setScreen(new AddEasyMCAccountScreen(theme, this))); addButton(l, "Microsoft", () -> mc.setScreen(new AddMicrosoftAccountScreen(theme, this))); } diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AddEasyMCAccountScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AddEasyMCAccountScreen.java deleted file mode 100644 index c491ee9d57..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/accounts/AddEasyMCAccountScreen.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.gui.screens.accounts; - -import meteordevelopment.meteorclient.gui.GuiTheme; -import meteordevelopment.meteorclient.gui.widgets.containers.WTable; -import meteordevelopment.meteorclient.gui.widgets.input.WTextBox; -import meteordevelopment.meteorclient.systems.accounts.types.EasyMCAccount; - -public class AddEasyMCAccountScreen extends AddAccountScreen { - public AddEasyMCAccountScreen(GuiTheme theme, AccountsScreen parent) { - super(theme, "Add an EasyMC Account", parent); - } - - @Override - public void initWidgets() { - WTable t = add(theme.table()).widget(); - - // Token - t.add(theme.label("Token: ")); - WTextBox token = t.add(theme.textBox("")).minWidth(400).expandX().widget(); - token.setFocused(true); - t.row(); - - // Add - add = t.add(theme.button("Add")).expandX().widget(); - add.action = () -> { - if (!token.get().isEmpty()) { - AccountsScreen.addAccount(this, parent, new EasyMCAccount(token.get())); - } - }; - - enterAction = add.action; - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountType.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountType.java index ae9520a2ab..e1c23b4e3f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountType.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountType.java @@ -8,6 +8,5 @@ public enum AccountType { Cracked, Microsoft, - TheAltening, - EasyMC + TheAltening } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Accounts.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Accounts.java index e09a4963b8..7a675043c3 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Accounts.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Accounts.java @@ -8,7 +8,6 @@ import meteordevelopment.meteorclient.systems.System; import meteordevelopment.meteorclient.systems.Systems; import meteordevelopment.meteorclient.systems.accounts.types.CrackedAccount; -import meteordevelopment.meteorclient.systems.accounts.types.EasyMCAccount; import meteordevelopment.meteorclient.systems.accounts.types.MicrosoftAccount; import meteordevelopment.meteorclient.systems.accounts.types.TheAlteningAccount; import meteordevelopment.meteorclient.utils.misc.NbtException; @@ -78,7 +77,6 @@ public Accounts fromTag(NbtCompound tag) { case Cracked -> new CrackedAccount(null).fromTag(t); case Microsoft -> new MicrosoftAccount(null).fromTag(t); case TheAltening -> new TheAlteningAccount(null).fromTag(t); - case EasyMC -> new EasyMCAccount(null).fromTag(t); }; if (account.fetchInfo()) return account; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java deleted file mode 100644 index 26f3e6e143..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/EasyMCAccount.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.accounts.types; - -import com.mojang.authlib.Environment; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.util.UndashedUuid; -import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor; -import meteordevelopment.meteorclient.mixin.YggdrasilMinecraftSessionServiceAccessor; -import meteordevelopment.meteorclient.systems.accounts.Account; -import meteordevelopment.meteorclient.systems.accounts.AccountType; -import meteordevelopment.meteorclient.systems.accounts.TokenAccount; -import meteordevelopment.meteorclient.utils.misc.NbtException; -import meteordevelopment.meteorclient.utils.network.Http; -import net.minecraft.client.session.Session; -import net.minecraft.nbt.NbtCompound; - -import java.util.Optional; - -import static meteordevelopment.meteorclient.MeteorClient.mc; - -public class EasyMCAccount extends Account implements TokenAccount { - - private static final Environment ENVIRONMENT = new Environment("https://sessionserver.easymc.io", "https://authserver.mojang.com", "EasyMC"); - private static final YggdrasilAuthenticationService SERVICE = new YggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy(), ENVIRONMENT); - private String token; - - public EasyMCAccount(String token) { - super(AccountType.EasyMC, token); - this.token = token; - } - - public String getToken() { - return token; - } - - @Override - public boolean fetchInfo() { - // we set the name to the session id after we redeem the token - the token length is 20, session id length is 43 - if (name.length() == 43) return true; - - AuthResponse res = Http.post("https://api.easymc.io/v1/token/redeem") - .bodyJson("{\"token\":\"" + name + "\"}") - .sendJson(AuthResponse.class); - - if (res != null) { - cache.username = res.mcName; - cache.uuid = res.uuid; - - name = res.session; - - return true; - } else { - return false; - } - } - - @Override - public boolean login() { - applyLoginEnvironment(SERVICE, YggdrasilMinecraftSessionServiceAccessor.createYggdrasilMinecraftSessionService(SERVICE.getServicesKeySet(), SERVICE.getProxy(), ENVIRONMENT)); - setSession(new Session(cache.username, UndashedUuid.fromStringLenient(cache.uuid), name, Optional.empty(), Optional.empty(), Session.AccountType.MOJANG)); - - cache.loadHead(); - return true; - } - - private static class AuthResponse { - public String mcName; - public String uuid; - public String session; - public String message; - } - - @Override - public NbtCompound toTag() { - NbtCompound tag = new NbtCompound(); - - tag.putString("type", type.name()); - tag.putString("name", name); - tag.putString("token", token); - tag.put("cache", cache.toTag()); - - return tag; - } - - @Override - public EasyMCAccount fromTag(NbtCompound tag) { - if (!tag.contains("name") || !tag.contains("cache") || !tag.contains("token")) throw new NbtException(); - - name = tag.getString("name"); - token = tag.getString("token"); - cache.fromTag(tag.getCompound("cache")); - - return this; - } -}