修复部分错误

This commit is contained in:
SerendipityR 2022-10-06 03:07:19 +08:00 committed by GitHub
parent 98870a9f6c
commit 0818de9d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -29,6 +29,7 @@ import com.github.steveice10.packetlib.event.session.*;
import com.github.steveice10.packetlib.packet.Packet;
import io.netty.util.internal.ConcurrentSet;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.ComponentSerializer;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
@ -368,7 +369,8 @@ public class NewBotAttack extends IAttack {
msg = e.getReason();
if (ProtocolLibs.adaptAfter754) {
Component component = GsonComponentSerializer.gson().deserialize(msg);
// Component component = GsonComponentSerializer.gson().deserialize(msg);
Component component = PlainTextComponentSerializer.plainText().deserialize(msg);
msg = PlainTextComponentSerializer.plainText().serialize(component);
}
@ -475,7 +477,6 @@ public class NewBotAttack extends IAttack {
} else if (recvPacket instanceof ServerChatPacket) {
ServerChatPacket chatPacket = (ServerChatPacket) recvPacket;
Message message = chatPacket.getMessage();
Map<String, String> result = VersionSupport754.clickVerifiesHandle(chatPacket, session, ConfigUtil.ClickVerifiesDetect, null);
if (result.get("result").contains("true")) {
@ -491,8 +492,8 @@ public class NewBotAttack extends IAttack {
alivePlayers.add(username);
}
if (ConfigUtil.ShowServerMessages && !message.getText().equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + message.getFullText(), "BotAttack");
if (ConfigUtil.ShowServerMessages && !result.get("msg").equals("")) {
LogUtil.doLog(0, "[服务端返回信息] [" + username + "] " + result.get("msg"), "BotAttack");
}
} else if (recvPacket instanceof ServerKeepAlivePacket) {
ClientKeepAlivePacket keepAlivePacket = new ClientKeepAlivePacket(((ServerKeepAlivePacket) recvPacket).getPingId());