Skip to content

Commit

Permalink
Add PacketReportFightAntiCheatNotify
Browse files Browse the repository at this point in the history
  • Loading branch information
亡灵暴龙大帝 committed Jun 29, 2024
1 parent b0c5e3c commit 3adcd8b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
44 changes: 44 additions & 0 deletions src/main/java/emu/grasscutter/command/commands/AceTestCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package emu.grasscutter.command.commands;

import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.server.packet.send.PacketReportFightAntiCheatNotify;
import lombok.val;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

import static emu.grasscutter.utils.lang.Language.translate;

@Command(
label = "AceTest",
usage = {"ace <msg>"},
permission = "server.AceTest",
targetRequirement = Command.TargetRequirement.PLAYER)
public final class AceTestCommand implements CommandHandler {

@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.isEmpty()) {
sendUsageMessage(sender);
return;
}

// val OneType =args.get(0);
int CheatType = Integer.parseInt(args.get(0));
var CheatCount = 1;
if (args.size() == 2) {
// float x = Float.parseFloat(args.get(1));
CheatCount = Integer.parseInt(args.get(1));
}

// int CheatType = Integer.parseInt(message);
// Grasscutter.getLogger().debug("String{}, int{}", message, CheatType);
targetPlayer.sendPacket(new PacketReportFightAntiCheatNotify(CheatType, CheatCount));
}

}
2 changes: 1 addition & 1 deletion src/main/java/emu/grasscutter/server/game/GameServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public void run() {
try {
onTick();
} catch (Exception e) {
Grasscutter.getLogger().error(translate("messages.game.game_update_error"), e);
// Grasscutter.getLogger().error(translate("messages.game.game_update_error"), e);
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package emu.grasscutter.server.packet.send;

import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.net.packet.*;
import emu.grasscutter.net.proto.ReportFightAntiCheatNotifyOuterClass.ReportFightAntiCheatNotify;

public class PacketReportFightAntiCheatNotify extends BasePacket {

public PacketReportFightAntiCheatNotify(int CheatType, int CheatCount) {
super(PacketOpcodes.ReportFightAntiCheatNotify, true);

ReportFightAntiCheatNotify proto =
ReportFightAntiCheatNotify.newBuilder()
.setCheatType(CheatType)
.setCheatCount(CheatCount)
.build();

this.setData(proto);
}
}

0 comments on commit 3adcd8b

Please sign in to comment.