PacketSample/README.md

822 B
Raw Blame History

给屑颜的留言

该插件使用 PaperSpigot 在 1.18 中提供的 paperweight-userdev 工具包进行开发Gradle 任务 runServer 可用于直接在Idea内启动简易服务端用于插件测试。

cc.maxmc.sample.packet

该部分为数据包拦截原理,我做的简易实现,实际开发过程中建议使用ProtocolLib/TabooLib等成熟数据包收发框架进行处理

cc.maxmc.sample.listener

该部分为聊天信息截取在Paper中该数据包

net.minecraft.network.protocol.game.ClientboundChatPacket#getMessage 用于发送系统信息(主要为TranslateKey)

net.minecraft.network.protocol.game.ClientboundChatPacket.adventure$message 用于发送玩家聊天信息

net.minecraft.network.protocol.game.ClientboundChatPacket.components 可能用于插件发送消息