diff --git a/src/main/java/meteordevelopment/meteorclient/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/commands/Commands.java index f5e2d99451..506b122401 100644 --- a/src/main/java/meteordevelopment/meteorclient/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/commands/Commands.java @@ -29,45 +29,46 @@ public class Commands { @PostInit(dependencies = PathManagers.class) public static void init() { - add(new VClipCommand()); - add(new HClipCommand()); - add(new DismountCommand()); - add(new DisconnectCommand()); + add(new BindCommand()); + add(new BindsCommand()); + add(new CommandsCommand()); add(new DamageCommand()); + add(new DisconnectCommand()); + add(new DismountCommand()); add(new DropCommand()); add(new EnchantCommand()); + add(new EnderChestCommand()); add(new FakePlayerCommand()); + add(new FovCommand()); add(new FriendsCommand()); - add(new CommandsCommand()); + add(new GamemodeCommand()); + add(new GiveCommand()); + add(new HClipCommand()); + add(new HelpCommand()); + add(new InputCommand()); add(new InventoryCommand()); + add(new LocateCommand()); + add(new LogoutCommand()); + add(new MacroCommand()); + add(new ModulesCommand()); + add(new NameHistoryCommand()); add(new NbtCommand()); add(new NotebotCommand()); add(new PeekCommand()); - add(new EnderChestCommand()); add(new ProfilesCommand()); add(new ReloadCommand()); add(new ResetCommand()); + add(new RotationCommand()); + add(new SaveMapCommand()); add(new SayCommand()); add(new ServerCommand()); - add(new SwarmCommand()); - add(new ToggleCommand()); add(new SettingCommand()); add(new SpectateCommand()); - add(new GamemodeCommand()); - add(new SaveMapCommand()); - add(new MacroCommand()); - add(new ModulesCommand()); - add(new BindsCommand()); - add(new GiveCommand()); - add(new NameHistoryCommand()); - add(new BindCommand()); - add(new FovCommand()); - add(new RotationCommand()); - add(new WaypointCommand()); - add(new InputCommand()); + add(new SwarmCommand()); + add(new ToggleCommand()); + add(new VClipCommand()); add(new WaspCommand()); - add(new LocateCommand()); - add(new HelpCommand()); + add(new WaypointCommand()); COMMANDS.sort(Comparator.comparing(Command::getName)); diff --git a/src/main/java/meteordevelopment/meteorclient/commands/commands/LogoutCommand.java b/src/main/java/meteordevelopment/meteorclient/commands/commands/LogoutCommand.java new file mode 100644 index 0000000000..d8ae97ffeb --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/commands/commands/LogoutCommand.java @@ -0,0 +1,52 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.commands.commands; + +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.commands.Command; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.render.LogoutSpots; +import meteordevelopment.meteorclient.utils.player.ChatUtils; +import net.minecraft.client.multiplayer.ClientSuggestionProvider; + +public class LogoutCommand extends Command { + public LogoutCommand() { + super("logout-spots", "Manage logout spots - clear all spots or remove specific players", "logout"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + LogoutSpots logoutSpots = Modules.get().get(LogoutSpots.class); + + builder.then(literal("clear") + .executes(_ -> { + logoutSpots.clearLogoutSpots(); + + ChatUtils.info("Cleared all logout spots"); + return SINGLE_SUCCESS; + }) + ); + + builder.then(literal("remove") + .then(argument("name", StringArgumentType.word()) + .executes(context -> { + String playerName = StringArgumentType.getString(context, "name"); + boolean removed = logoutSpots.removeLogoutSpot(playerName); + + if (removed) { + ChatUtils.info("Removed logout spot for player: " + playerName); + } else { + ChatUtils.error("No logout spot found for player: " + playerName); + } + return SINGLE_SUCCESS; + }) + ) + ); + + + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java index 10107bbfbe..28339de7d3 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/LogoutSpots.java @@ -9,6 +9,10 @@ import meteordevelopment.meteorclient.events.render.Render2DEvent; import meteordevelopment.meteorclient.events.render.Render3DEvent; import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.gui.GuiTheme; +import meteordevelopment.meteorclient.gui.widgets.WWidget; +import meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList; +import meteordevelopment.meteorclient.gui.widgets.pressable.WButton; import meteordevelopment.meteorclient.renderer.Renderer2D; import meteordevelopment.meteorclient.renderer.ShapeMode; import meteordevelopment.meteorclient.renderer.text.TextRenderer; @@ -40,6 +44,13 @@ public class LogoutSpots extends Module { // General + private final Setting clearOnDeactivate = sgGeneral.add(new BoolSetting.Builder() + .name("clear-on-deactivate") + .description("Clears all logout spot when module is deactivated.") + .defaultValue(false) + .build() + ); + private final Setting scale = sgGeneral.add(new DoubleSetting.Builder() .name("scale") .description("The scale.") @@ -105,6 +116,17 @@ public LogoutSpots() { lineColor.onChanged(); } + @Override + public WWidget getWidget(GuiTheme theme) { + WVerticalList list = theme.verticalList(); + + WButton clear = list.add(theme.button("Clear Logout Spots")).expandX().widget(); + + clear.action = this::clearLogoutSpots; + + return list; + } + @Override public void onActivate() { lastPlayerList.addAll(mc.getConnection().getOnlinePlayers()); @@ -116,10 +138,9 @@ public void onActivate() { @Override public void onDeactivate() { - players.clear(); - lastPlayerList.clear(); + if (clearOnDeactivate.get()) clearLogoutSpots(); } - + private void updateLastPlayers() { lastPlayers.clear(); for (Entity entity : mc.level.entitiesForRendering()) { @@ -196,6 +217,15 @@ public String getInfoString() { return Integer.toString(players.size()); } + public void clearLogoutSpots() { + players.clear(); + lastPlayerList.clear(); + } + + public boolean removeLogoutSpot(String playerName) { + return players.removeIf(entry -> entry.name.equalsIgnoreCase(playerName)); + } + private static final Vector3d pos = new Vector3d(); private class Entry {