Fix prevent AntiCheat Block Breaking (In Scripts)

Fix prevent AntiCheat Block Breaking (In Scripts)
This commit is contained in:
Anon 2024-12-25 16:56:07 +01:00 committed by GitHub
commit 2409de2a2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 100 additions and 16 deletions

View file

@ -22,6 +22,7 @@ namespace MinecraftClient.Commands
);
dispatcher.Register(l => l.Literal(CmdName)
// TODO Get blockFace direction from arguments
.Executes(r => DigLookAt(r.Source))
.Then(l => l.Argument("Duration", Arguments.Double())
.Executes(r => DigLookAt(r.Source, Arguments.GetDouble(r, "Duration"))))
@ -58,7 +59,7 @@ namespace MinecraftClient.Commands
Block block = handler.GetWorld().GetBlock(blockToBreak);
if (block.Type == Material.Air)
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_no_block);
else if (handler.DigBlock(blockToBreak, duration: duration))
else if (handler.DigBlock(blockToBreak, Direction.Down, duration: duration))
{
blockToBreak = blockToBreak.ToCenter();
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_dig_dig, blockToBreak.X, blockToBreak.Y, blockToBreak.Z, block.GetTypeString()));
@ -78,7 +79,7 @@ namespace MinecraftClient.Commands
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_too_far);
else if (block.Type == Material.Air)
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_no_block);
else if (handler.DigBlock(blockLoc, lookAtBlock: false, duration: duration))
else if (handler.DigBlock(blockLoc, Direction.Down, lookAtBlock: false, duration: duration))
return r.SetAndReturn(Status.Done, string.Format(Translations.cmd_dig_dig, blockLoc.X, blockLoc.Y, blockLoc.Z, block.GetTypeString()));
else
return r.SetAndReturn(Status.Fail, Translations.cmd_dig_fail);