forked from Grasscutters/Grasscutter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PacketReportFightAntiCheatNotify
- Loading branch information
亡灵暴龙大帝
committed
Jun 29, 2024
1 parent
b0c5e3c
commit 3adcd8b
Showing
3 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/main/java/emu/grasscutter/command/commands/AceTestCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/emu/grasscutter/server/packet/send/PacketReportFightAntiCheatNotify.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |