Skip to content

Commit e812e26

Browse files
committed
session id login now works on newer versions
1 parent 1d1ba1d commit e812e26

File tree

9 files changed

+211
-14
lines changed

9 files changed

+211
-14
lines changed

src/main/java/com/nxyi/addon/Addon.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.mojang.logging.LogUtils;
44
import com.nxyi.addon.commands.*;
55
import com.nxyi.addon.hud.HudExample;
6+
import com.nxyi.addon.irc.IRC;
67
import com.nxyi.addon.modules.*;
78
import meteordevelopment.meteorclient.addons.MeteorAddon;
89
import meteordevelopment.meteorclient.commands.Commands;
@@ -14,6 +15,8 @@
1415
import org.slf4j.Logger;
1516

1617
public class Addon extends MeteorAddon {
18+
private static IRC irc;
19+
1720
public static String BOOTNAME;
1821
public static String BOOTUUID;
1922
public static String BOOTSESSION;
@@ -56,6 +59,7 @@ public void onInitialize() {
5659
Modules.get().add(new phase());
5760
Modules.get().add(new AntiBorder());
5861
Modules.get().add(new Bookchat());
62+
// Modules.get().add(new com.nxyi.addon.modules.IRC());
5963

6064

6165
// Commands
@@ -73,6 +77,7 @@ public void onInitialize() {
7377
Commands.add(new ReloadCapes());
7478
Commands.add(new SpamCommand());
7579
Commands.add(new CrackedOpSpamCommand());
80+
Commands.add(new IRCCommand());
7681

7782
// HUD
7883
Hud.get().register(HudExample.INFO);
@@ -83,6 +88,14 @@ public void onInitialize() {
8388
BOOTNAME = MinecraftClient.getInstance().getSession().getUsername();
8489
}
8590

91+
public static void startIRC(String username) {
92+
irc = new IRC(username, "irc.libera.chat", 6697);
93+
}
94+
95+
public static IRC getIrc() {
96+
return irc;
97+
}
98+
8699
@Override
87100
public void onRegisterCategories() {
88101
Modules.registerCategory(CATEGORY);

src/main/java/com/nxyi/addon/commands/CrackedOpSpamCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,18 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
2323
new Thread(() -> {
2424
for (int i = 0; i < amount; i++){
2525
MinecraftClient.getInstance().player.networkHandler.sendChatCommand("op " + name + i);
26+
sleep(500);
2627
}
2728
}).start();
2829

2930
return 1;
3031
})));
3132
}
33+
34+
public static void sleep(long ms) {
35+
try {
36+
Thread.sleep(ms);
37+
} catch (Exception ignored) {
38+
}
39+
}
3240
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.nxyi.addon.commands;
2+
3+
import com.mojang.brigadier.arguments.StringArgumentType;
4+
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
5+
import com.nxyi.addon.Addon;
6+
import com.sun.jdi.connect.Connector;
7+
import meteordevelopment.meteorclient.commands.Command;
8+
import net.minecraft.command.CommandSource;
9+
10+
public class IRCCommand extends Command {
11+
public IRCCommand() {
12+
super("irc", "Send messages to the irc client");
13+
}
14+
15+
@Override
16+
public void build(LiteralArgumentBuilder<CommandSource> builder) {
17+
builder.then(argument("text", StringArgumentType.greedyString()).executes(ctx -> {
18+
String text = StringArgumentType.getString(ctx, "text");
19+
if (Addon.getIrc().isConnected()){
20+
Addon.getIrc().getReceiver().getSender().addMessage(text);
21+
}
22+
else error("You are not connected to the IRC");
23+
24+
return 0;
25+
}));
26+
}
27+
}

src/main/java/com/nxyi/addon/commands/SpamCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ public SpamCommand() {
1616

1717
@Override
1818
public void build(LiteralArgumentBuilder<CommandSource> builder) {
19-
builder.then(argument("amount" ,IntegerArgumentType.integer(0))
20-
.then(argument("text", StringArgumentType.string())).executes(ctx -> {
19+
builder.then(argument("amount", IntegerArgumentType.integer(0))
20+
.then(argument("text", StringArgumentType.string()).executes(ctx -> {
2121
int amount = IntegerArgumentType.getInteger(ctx, "amount");
2222
String text = StringArgumentType.getString(ctx, "text");
2323

24-
for (int i = 0; i < amount; i++){
24+
for (int i = 0; i < amount; i++) {
2525
MinecraftClient.getInstance().player.networkHandler.sendChatMessage(text);
2626
}
2727

2828
return SINGLE_SUCCESS;
29-
}));
29+
})));
3030
}
3131
}

src/main/java/com/nxyi/addon/gui/screens/SessionIDScreen.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
import meteordevelopment.meteorclient.gui.WindowScreen;
88
import meteordevelopment.meteorclient.gui.widgets.containers.WTable;
99
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
10+
import meteordevelopment.meteorclient.systems.accounts.Account;
11+
import meteordevelopment.meteorclient.systems.accounts.Accounts;
1012
import net.minecraft.client.MinecraftClient;
1113
import net.minecraft.client.gui.screen.Screen;
1214
import net.minecraft.client.gui.screen.TitleScreen;
1315
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
16+
import net.minecraft.client.util.Session;
17+
18+
import java.util.Optional;
1419

1520
public class SessionIDScreen extends WindowScreen {
1621
private final MultiplayerScreen multiplayerScreen;
@@ -43,22 +48,14 @@ public void initWidgets() {
4348
t.add(theme.button("Done")).minWidth(220).expandX().widget().action = () -> {
4449
if (ID.get().isEmpty() || UUID.get().isEmpty() || USER.get().isEmpty()) return;
4550

46-
SetSession.username = USER.get();
47-
SetSession.UUID = UUID.get();
48-
SetSession.accessToken = ID.get();
51+
Account.setSession(new Session(USER.get(), UUID.get(), ID.get(), Optional.empty(), Optional.empty(), Session.AccountType.MOJANG));
4952

50-
SetSession.sessionid = "token:" + SetSession.accessToken + ":" + SetSession.UUID;
51-
SetSession.originalSession = false;
5253
mc.setScreen(new MultiplayerScreen(this.parent));
5354
};
5455

5556
t.add(theme.button("Return ACC")).minWidth(220).expandX().widget().action = () -> {
56-
SetSession.username = Addon.BOOTNAME;
57-
SetSession.UUID = Addon.BOOTUUID;
58-
SetSession.accessToken = Addon.BOOTSESSION;
57+
Account.setSession(new Session(Addon.BOOTNAME, Addon.BOOTUUID, Addon.BOOTSESSION, Optional.empty(), Optional.empty(), Session.AccountType.MOJANG));
5958

60-
SetSession.sessionid = "token:" + SetSession.accessToken + ":" + SetSession.UUID;
61-
SetSession.originalSession = false;
6259
mc.setScreen(new MultiplayerScreen(this.parent));
6360
};
6461
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.nxyi.addon.irc;
2+
3+
import java.io.IOException;
4+
import java.io.PrintWriter;
5+
import java.net.Socket;
6+
import java.util.Scanner;
7+
8+
public class IRC {
9+
10+
private String username;
11+
private IRCReceiver receiver;
12+
private boolean connected;
13+
14+
public IRC(final String username, final String host, final int port) {
15+
this.username = username;
16+
17+
try {
18+
final Socket socket = new Socket(host, port);
19+
final Scanner in = new Scanner(socket.getInputStream());
20+
final PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
21+
final Scanner inp = new Scanner(System.in);
22+
23+
receiver = new IRCReceiver(socket, in, out, inp, username);
24+
receiver.start();
25+
} catch (IOException e) {
26+
e.printStackTrace();
27+
}
28+
}
29+
30+
public String getUsername() {
31+
return username;
32+
}
33+
34+
public IRCReceiver getReceiver() {
35+
return receiver;
36+
}
37+
38+
public boolean isConnected() {
39+
return connected;
40+
}
41+
42+
public void setConnected(final boolean connected) {
43+
this.connected = connected;
44+
}
45+
46+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.nxyi.addon.irc;
2+
3+
import java.io.PrintWriter;
4+
import java.net.Socket;
5+
import java.util.Scanner;
6+
7+
import com.nxyi.addon.Addon;
8+
import com.nxyi.addon.modules.IRC;
9+
import meteordevelopment.meteorclient.systems.modules.Modules;
10+
import net.minecraft.client.MinecraftClient;
11+
import net.minecraft.text.Text;
12+
13+
public class IRCReceiver extends Thread {
14+
static MinecraftClient mc = MinecraftClient.getInstance();
15+
16+
Socket socket;
17+
Scanner in;
18+
PrintWriter out;
19+
Scanner inp;
20+
boolean loggedIN;
21+
String username;
22+
23+
IRCSender sender;
24+
25+
public IRCReceiver(Socket socket, Scanner in, PrintWriter out, Scanner inp, String username) {
26+
this.socket = socket;
27+
this.in = in;
28+
this.out = out;
29+
this.inp = inp;
30+
this.loggedIN = false;
31+
this.username = username;
32+
}
33+
34+
public void run() {
35+
while (true) {
36+
if (in.hasNextLine()) {
37+
final String line = in.nextLine();
38+
if (line.startsWith("SUBMITNAME")) {
39+
out.println(username + ":" + Addon.CATEGORY.name);
40+
} else if (line.startsWith("NAMEACCEPTED")) {
41+
System.out.println("Connected to IRC! Your Username is " + username);
42+
Addon.getIrc().setConnected(true);
43+
if (!loggedIN) {
44+
sender = new IRCSender(socket, in, out, inp);
45+
sender.start();
46+
}
47+
} else if (line.startsWith("MESSAGE")) {
48+
if (mc.player != null && Modules.get().isActive(IRC.class)) {
49+
final String l = line.substring(8);
50+
final String username = l.split(" ")[0].split(":")[0];
51+
final String client = l.split(" ")[0].split(":")[1];
52+
mc.player.sendMessage(Text.of("(§cIRC§f) " + "§8(§a§n" + username + "§f - [§8" + client + "§f]" + "§8)§f: " + l.substring(username.length() + client.length() + 1)));
53+
}
54+
}
55+
}
56+
}
57+
}
58+
59+
public IRCSender getSender() {
60+
return sender;
61+
}
62+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.nxyi.addon.irc;
2+
3+
import java.io.PrintWriter;
4+
import java.net.Socket;
5+
import java.util.Scanner;
6+
7+
public class IRCSender extends Thread {
8+
Socket socket;
9+
Scanner in;
10+
PrintWriter out;
11+
Scanner inp;
12+
13+
public IRCSender(final Socket socket, final Scanner in, final PrintWriter out, final Scanner inp) {
14+
this.socket = socket;
15+
this.in = in;
16+
this.out = out;
17+
this.inp = inp;
18+
}
19+
20+
public void run() {
21+
while (true) {}
22+
}
23+
24+
public void addMessage(final String message) {
25+
out.println(message);
26+
}
27+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.nxyi.addon.modules;
2+
3+
import com.nxyi.addon.Addon;
4+
import meteordevelopment.meteorclient.systems.modules.Category;
5+
import meteordevelopment.meteorclient.systems.modules.Module;
6+
import net.minecraft.data.client.Model;
7+
8+
public class IRC extends Module {
9+
public IRC() {
10+
super(Addon.CATEGORY, "IRC", "chat with other people on the client");
11+
}
12+
13+
@Override
14+
public void onActivate() {
15+
Addon.startIRC(mc.getSession().getUsername());
16+
}
17+
}

0 commit comments

Comments
 (0)