Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Jan 8, 2025
1 parent a8fff35 commit 59754fd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private PlayerInput modifyInput(PlayerInput original) {
EventManager.INSTANCE.callEvent(event);
var directionalInput = changeDirection(event.getDirectionalInput());

var sprintEvent = new SprintEvent(original.sprint(), SprintEvent.Source.INPUT);
var sprintEvent = new SprintEvent(directionalInput, original.sprint(), SprintEvent.Source.INPUT);
EventManager.INSTANCE.callEvent(sprintEvent);

return new PlayerInput(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ class MovementInputEvent(
) : Event()

@Nameable("sprint")
class SprintEvent(var sprint: Boolean, val source: Source) : Event() {
enum class Source(val key: Boolean) {
INPUT(true),
MOVEMENT_TICK(true),
NETWORK(false)
class SprintEvent(val directionalInput: DirectionalInput, var sprint: Boolean, val source: Source) : Event() {
enum class Source {
INPUT,
MOVEMENT_TICK,
NETWORK
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ object ModuleSuperKnockback : ClientModule("SuperKnockback", Category.COMBAT, al
private val movementHandler = handler<SprintEvent>(
priority = EventPriorityConvention.FIRST_PRIORITY
) { event ->
if (cancelSprint && event.source.key) {
if (cancelSprint && (event.source == SprintEvent.Source.MOVEMENT_TICK ||
event.source == SprintEvent.Source.INPUT)) {
event.sprint = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ object ModuleKillAura : ClientModule("KillAura", Category.COMBAT) {

@Suppress("unused")
private val sprintHandler = handler<SprintEvent> { event ->
if (shouldBlockSprinting) {
if (shouldBlockSprinting && (event.source == SprintEvent.Source.MOVEMENT_TICK ||
event.source == SprintEvent.Source.INPUT)) {
event.sprint = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ object ModuleSprint : ClientModule("Sprint", Category.MOVEMENT) {
private val sprintHandler = handler<SprintEvent>(
priority = EventPriorityConvention.FIRST_PRIORITY
) { event ->
if (!event.directionalInput.isMoving) {
return@handler
}

if (event.source == SprintEvent.Source.MOVEMENT_TICK || event.source == SprintEvent.Source.INPUT) {
event.sprint = true
}
Expand Down

0 comments on commit 59754fd

Please sign in to comment.