Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions src/main/java/meteordevelopment/meteorclient/commands/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
Original file line number Diff line number Diff line change
@@ -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<ClientSuggestionProvider> 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;
})
)
);


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -40,6 +44,13 @@ public class LogoutSpots extends Module {

// General

private final Setting<Boolean> 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<Double> scale = sgGeneral.add(new DoubleSetting.Builder()
.name("scale")
.description("The scale.")
Expand Down Expand Up @@ -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());
Expand All @@ -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()) {
Expand Down Expand Up @@ -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 {
Expand Down