-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1478 from ManInMyVan/SprintChecks
Add NoSlowC, NoSlowD, and NoSlowE
- Loading branch information
Showing
9 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowC.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,47 @@ | ||
package ac.grim.grimac.checks.impl.movement; | ||
|
||
import ac.grim.grimac.checks.Check; | ||
import ac.grim.grimac.checks.CheckData; | ||
import ac.grim.grimac.checks.type.PacketCheck; | ||
import ac.grim.grimac.checks.type.PostPredictionCheck; | ||
import ac.grim.grimac.player.GrimPlayer; | ||
import ac.grim.grimac.utils.anticheat.update.PredictionComplete; | ||
import com.github.retrooper.packetevents.event.PacketReceiveEvent; | ||
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.protocol.player.ClientVersion; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; | ||
|
||
@CheckData(name = "NoSlowC", setback = 5, experimental = true) | ||
public class NoSlowC extends Check implements PostPredictionCheck, PacketCheck { | ||
public NoSlowC(GrimPlayer player) { | ||
super(player); | ||
} | ||
|
||
public boolean startedSprintingBeforeSlowMovement = false; | ||
|
||
@Override | ||
public void onPacketReceive(PacketReceiveEvent event) { | ||
if (event.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) { | ||
if (new WrapperPlayClientEntityAction(event).getAction() == WrapperPlayClientEntityAction.Action.START_SPRINTING) { | ||
startedSprintingBeforeSlowMovement = false; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onPredictionComplete(final PredictionComplete predictionComplete) { | ||
if (!predictionComplete.isChecked()) return; | ||
|
||
if (player.isSlowMovement) { | ||
// https://bugs.mojang.com/browse/MC-152728 | ||
if (startedSprintingBeforeSlowMovement && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14_2)) { | ||
reward(); | ||
return; | ||
} | ||
|
||
if (player.isSprinting && player.sneakingSpeedMultiplier < 0.8f) { | ||
if (flagWithSetback()) alert(""); | ||
} else reward(); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowD.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,53 @@ | ||
package ac.grim.grimac.checks.impl.movement; | ||
|
||
import ac.grim.grimac.checks.Check; | ||
import ac.grim.grimac.checks.CheckData; | ||
import ac.grim.grimac.checks.type.PacketCheck; | ||
import ac.grim.grimac.checks.type.PostPredictionCheck; | ||
import ac.grim.grimac.player.GrimPlayer; | ||
import ac.grim.grimac.utils.anticheat.update.PredictionComplete; | ||
import com.github.retrooper.packetevents.event.PacketReceiveEvent; | ||
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.protocol.player.ClientVersion; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; | ||
|
||
@CheckData(name = "NoSlowD", setback = 5, experimental = true) | ||
public class NoSlowD extends Check implements PostPredictionCheck, PacketCheck { | ||
public NoSlowD(GrimPlayer player) { | ||
super(player); | ||
} | ||
|
||
public boolean startedSprintingBeforeUse = false; | ||
private boolean flaggedLastTick = false; | ||
|
||
@Override | ||
public void onPacketReceive(PacketReceiveEvent event) { | ||
if (event.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) { | ||
if (new WrapperPlayClientEntityAction(event).getAction() == WrapperPlayClientEntityAction.Action.START_SPRINTING) { | ||
startedSprintingBeforeUse = false; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onPredictionComplete(final PredictionComplete predictionComplete) { | ||
if (!predictionComplete.isChecked()) return; | ||
|
||
if (player.packetStateData.slowedByUsingItem) { | ||
// https://bugs.mojang.com/browse/MC-152728 | ||
if (startedSprintingBeforeUse && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14_2)) { | ||
reward(); | ||
flaggedLastTick = false; | ||
return; | ||
} | ||
|
||
if (player.isSprinting) { | ||
if (flaggedLastTick && flagWithSetback()) alert(""); | ||
flaggedLastTick = true; | ||
} else { | ||
reward(); | ||
flaggedLastTick = false; | ||
} | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/ac/grim/grimac/checks/impl/movement/NoSlowE.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,42 @@ | ||
package ac.grim.grimac.checks.impl.movement; | ||
|
||
import ac.grim.grimac.checks.Check; | ||
import ac.grim.grimac.checks.CheckData; | ||
import ac.grim.grimac.checks.type.PacketCheck; | ||
import ac.grim.grimac.checks.type.PostPredictionCheck; | ||
import ac.grim.grimac.player.GrimPlayer; | ||
import ac.grim.grimac.utils.anticheat.update.PredictionComplete; | ||
import com.github.retrooper.packetevents.event.PacketReceiveEvent; | ||
import com.github.retrooper.packetevents.protocol.packettype.PacketType; | ||
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientEntityAction; | ||
|
||
import static com.github.retrooper.packetevents.protocol.potion.PotionTypes.BLINDNESS; | ||
|
||
@CheckData(name = "NoSlowE", setback = 5, experimental = true) | ||
public class NoSlowE extends Check implements PostPredictionCheck, PacketCheck { | ||
public NoSlowE(GrimPlayer player) { | ||
super(player); | ||
} | ||
|
||
public boolean startedSprintingBeforeBlind = false; | ||
|
||
@Override | ||
public void onPacketReceive(PacketReceiveEvent event) { | ||
if (event.getPacketType() == PacketType.Play.Client.ENTITY_ACTION) { | ||
if (new WrapperPlayClientEntityAction(event).getAction() == WrapperPlayClientEntityAction.Action.START_SPRINTING) { | ||
startedSprintingBeforeBlind = false; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onPredictionComplete(final PredictionComplete predictionComplete) { | ||
if (!predictionComplete.isChecked()) return; | ||
|
||
if (player.compensatedEntities.getSelf().potionsMap != null && player.compensatedEntities.getSelf().potionsMap.containsKey(BLINDNESS)) { | ||
if (player.isSprinting && !startedSprintingBeforeBlind) { | ||
if (flagWithSetback()) alert(""); | ||
} else reward(); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/main/java/ac/grim/grimac/events/packets/PacketEntityAction.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
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
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
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
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
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