花雨庭AutoReport
以下代碼來自ChatGPT
package net.ccbluex.liquidbounce.features.module.modules.player
import net.ccbluex.liquidbounce.event.EventTarget
import net.ccbluex.liquidbounce.event.PacketEvent
import net.ccbluex.liquidbounce.features.module.Module
import net.ccbluex.liquidbounce.features.module.ModuleCategory
import net.ccbluex.liquidbounce.features.module.ModuleInfo
import net.minecraft.network.play.server.S08PacketPlayerPosLook
import net.minecraft.network.play.server.S12PacketEntityVelocity
import net.minecraft.network.play.server.S27PacketExplosion
import net.minecraft.client.Minecraft
@ModuleInfo(name = "AutoReport", category = ModuleCategory.RENDER)
class AutoReport?: Module() {
? ?private var prevX: Double = 0.0
? ?private var prevY: Double = 0.0
? ?private var prevZ: Double = 0.0
? ?@EventTarget
? ?fun onPacket(event: PacketEvent) {
? ? ? ?val packet = event.packet
? ? ? ?if (packet is S08PacketPlayerPosLook) {
? ? ? ? ? ?val playerName = Minecraft.getMinecraft().thePlayer.name
? ? ? ? ? ?val player = Minecraft.getMinecraft().thePlayer
? ? ? ? ? ?val yaw = packet.yaw
? ? ? ? ? ?val pitch = packet.pitch
? ? ? ? ? ?// 判斷玩家是否開啟了 KillAura
? ? ? ? ? ?val hasKillAura = Minecraft.getMinecraft().thePlayer.isSwingInProgress && Minecraft.getMinecraft().objectMouseOver.entityHit != null
? ? ? ? ? ?// 判斷玩家是否開啟了 Speed
? ? ? ? ? ?val hasSpeed =
? ? ? ? ? ? ? ? ? ?player.motionX > 0.2 || player.motionZ > 0.2
? ? ? ? ? ?// 判斷玩家是否開啟了 Blink
? ? ? ? ? ?val hasBlink =
? ? ? ? ? ? ? ? ? ?Math.abs(player.posX - prevX) < 0.1 && Math.abs(player.posY - prevY) < 0.1 && Math.abs(player.posZ - prevZ) < 0.1
? ? ? ? ? ?if (hasKillAura) {
? ? ? ? ? ? ? ?val reportReason = "使用了 KillAura"
? ? ? ? ? ? ? ?reportPlayer(playerName, reportReason)
? ? ? ? ? ?}
? ? ? ? ? ?if (hasSpeed) {
? ? ? ? ? ? ? ?val reportReason = "使用了 Speed"
? ? ? ? ? ? ? ?reportPlayer(playerName, reportReason)
? ? ? ? ? ?}
? ? ? ? ? ?if (hasBlink) {
? ? ? ? ? ? ? ?val reportReason = "使用了 Blink"
? ? ? ? ? ? ? ?reportPlayer(playerName, reportReason)
? ? ? ? ? ?}
? ? ? ? ? ?prevX = player.posX
? ? ? ? ? ?prevY = player.posY
? ? ? ? ? ?prevZ = player.posZ
? ? ? ?} else if (packet is S12PacketEntityVelocity) {
? ? ? ? ? ?val playerName = Minecraft.getMinecraft().thePlayer.name
? ? ? ? ? ?val player = Minecraft.getMinecraft().thePlayer
? ? ? ? ? ?val entityID = packet.entityID
? ? ? ? ? ?val velocityX = packet.motionX
? ? ? ? ? ?val velocityY = packet.motionY
? ? ? ? ? ?val velocityZ = packet.motionZ
? ? ? ? ? ?// 判斷玩家是否開啟了 KillAura
? ? ? ? ? ?val hasKillAura = Minecraft.getMinecraft().thePlayer.isSwingInProgress && Minecraft.getMinecraft().objectMouseOver.entityHit != null
? ? ? ? ? ?// 判斷玩家是否開啟了 Speed
? ? ? ? ? ?val hasSpeed =
? ? ? ? ? ? ? ? ? ?player.motionX > 0.2 || player.motionZ > 0.2
? ? ? ? ? ?// 判斷玩家是否開啟了 Blink
? ? ? ? ? ?val hasBlink =
? ? ? ? ? ? ? ? ? ?player.motionX == 0.0 && player.motionZ == 0.0
? ? ? ? ? ?// 判斷玩家是否受到了 Velocity,并且沒有其他已知的功能開啟
? ? ? ? ? ?val hasVelocity = entityID == Minecraft.getMinecraft().thePlayer.entityId && !hasKillAura && !hasSpeed && !hasBlink
? ? ? ? ? ?if (hasVelocity) {
? ? ? ? ? ? ? ?val reportReason = "受到了 Velocity"
? ? ? ? ? ? ? ?reportPlayer(playerName, reportReason)
? ? ? ? ? ?}
? ? ? ?}
? ?}
}
// 定義一個(gè)舉報(bào)玩家的函數(shù)
fun reportPlayer(playerId: String, reason: String) {
? ?val selfName = Minecraft.getMinecraft().thePlayer.name
? ?if (playerId != selfName) {
? ? ? ?val reportCommand = "/report $playerId $reason"
? ? ? ?// 這里可以添加代碼來發(fā)送舉報(bào)命令給游戲服務(wù)器
? ? ? ?println("已自動(dòng)向游戲服務(wù)器提交舉報(bào):$reportCommand")
? ?}
}