This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed MovementService a bit to prevent allocations
- Loading branch information
1 parent
d04f112
commit 8b3528f
Showing
4 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
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
20 changes: 16 additions & 4 deletions
20
src/main/java/me/earth/phobot/modules/client/anticheat/MovementAntiCheat.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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package me.earth.phobot.modules.client.anticheat; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import me.earth.phobot.movement.BunnyHop; | ||
import me.earth.phobot.movement.BunnyHopCC; | ||
import me.earth.phobot.movement.BunnyHopNcp; | ||
import me.earth.phobot.movement.Movement; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum MovementAntiCheat { | ||
Vanilla, | ||
Ncp, | ||
CC, | ||
Grim | ||
Vanilla(new BunnyHop()), // TODO: vanilla bhop is just 3arth 1.12.2 bhop | ||
Ncp(new BunnyHopNcp()), | ||
CC(new BunnyHopCC()), | ||
Grim(new BunnyHopCC()); // TODO: for now, this needs a real one | ||
|
||
// TODO: should probably go into a separate bhop mode setting or something | ||
private final Movement movement; | ||
|
||
} |
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: 5 additions & 17 deletions
22
src/main/java/me/earth/phobot/services/MovementService.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 |
---|---|---|
@@ -1,27 +1,15 @@ | ||
package me.earth.phobot.services; | ||
|
||
import lombok.Getter; | ||
import me.earth.phobot.Phobot; | ||
import me.earth.phobot.movement.BunnyHop; | ||
import me.earth.phobot.movement.BunnyHopCC; | ||
import me.earth.phobot.movement.BunnyHopNcp; | ||
import lombok.RequiredArgsConstructor; | ||
import me.earth.phobot.modules.client.anticheat.AntiCheat; | ||
import me.earth.phobot.movement.Movement; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public class MovementService { | ||
private Movement movement; | ||
|
||
public Movement getMovement(Phobot phobot) { | ||
switch(phobot.getAntiCheat().getMovement().getValue()) { | ||
case CC -> movement = new BunnyHopCC(); | ||
case Ncp -> movement = new BunnyHopNcp(); | ||
case Grim, Vanilla -> movement = new BunnyHop(); | ||
} | ||
return movement; | ||
} | ||
private final AntiCheat antiCheat; | ||
|
||
public Movement getMovement() { | ||
return new BunnyHopCC(); | ||
return antiCheat.getMovement().getValue().getMovement(); | ||
} | ||
|
||
} |