Skip to content

Commit 44fc2ed

Browse files
authored
Merge pull request #552 from ItzKatze/master
fix anticheat errors
2 parents 9f2c2c6 + b1167b0 commit 44fc2ed

46 files changed

Lines changed: 304 additions & 235 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

anticheat/build.gradle.kts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ repositories {
1717
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
1818
}
1919
}
20+
21+
maven {
22+
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
23+
}
24+
25+
maven {
26+
url = uri("https://repo.dmulloy2.net/repository/public/")
27+
}
2028
}
2129

2230
dependencies {
@@ -25,13 +33,16 @@ dependencies {
2533
}
2634
implementation("org.tinylog:tinylog-api:2.7.0")
2735
implementation("org.tinylog:tinylog-impl:2.7.0")
36+
37+
compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
38+
39+
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0")
2840
}
2941

3042
tasks.test {
3143
useJUnitPlatform()
3244
}
3345

34-
3546
java {
3647
sourceCompatibility = JavaVersion.VERSION_17
3748
targetCompatibility = JavaVersion.VERSION_17

anticheat/src/main/java/net/swofty/anticheat/api/AnticheatAPI.java

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package net.swofty.anticheat.api;
22

3+
import lombok.Getter;
34
import net.swofty.anticheat.api.modifier.CustomModifierRegistry;
45
import net.swofty.anticheat.api.player.BypassManager;
56
import net.swofty.anticheat.api.player.PlayerDataRegistry;
6-
import net.swofty.anticheat.detection.FlagType;
7+
import net.swofty.anticheat.flag.FlagType;
78
import net.swofty.anticheat.prediction.modifier.FrictionModifier;
89
import net.swofty.anticheat.prediction.modifier.VelocityModifier;
910

@@ -19,8 +20,14 @@
1920
* - Hook into detection events
2021
*/
2122
public class AnticheatAPI {
23+
24+
@Getter
2225
private static final CustomModifierRegistry modifierRegistry = new CustomModifierRegistry();
26+
27+
@Getter
2328
private static final PlayerDataRegistry playerDataRegistry = new PlayerDataRegistry();
29+
30+
@Getter
2431
private static final BypassManager bypassManager = new BypassManager();
2532

2633
/**
@@ -152,31 +159,4 @@ public static boolean hasBypass(UUID uuid, FlagType flagType) {
152159
public static void clearBypasses(UUID uuid) {
153160
bypassManager.clearBypasses(uuid);
154161
}
155-
156-
/**
157-
* Get the custom modifier registry.
158-
*
159-
* @return The modifier registry
160-
*/
161-
public static CustomModifierRegistry getModifierRegistry() {
162-
return modifierRegistry;
163-
}
164-
165-
/**
166-
* Get the player data registry.
167-
*
168-
* @return The player data registry
169-
*/
170-
public static PlayerDataRegistry getPlayerDataRegistry() {
171-
return playerDataRegistry;
172-
}
173-
174-
/**
175-
* Get the bypass manager.
176-
*
177-
* @return The bypass manager
178-
*/
179-
public static BypassManager getBypassManager() {
180-
return bypassManager;
181-
}
182162
}

anticheat/src/main/java/net/swofty/anticheat/api/player/BypassManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package net.swofty.anticheat.api.player;
22

3-
import net.swofty.anticheat.detection.FlagType;
3+
import net.swofty.anticheat.flag.FlagType;
44

5-
import java.util.HashMap;
65
import java.util.Map;
76
import java.util.UUID;
87
import java.util.concurrent.ConcurrentHashMap;

anticheat/src/main/java/net/swofty/anticheat/api/player/PlayerDataRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public Object getData(UUID uuid, String key) {
1919

2020
public <T> T getData(UUID uuid, String key, Class<T> type) {
2121
Object data = getData(uuid, key);
22-
if (data != null && type.isInstance(data)) {
22+
if (type.isInstance(data)) {
2323
return type.cast(data);
2424
}
2525
return null;
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package net.swofty.anticheat.event.events;
22

3+
import lombok.Getter;
34
import net.swofty.anticheat.event.packet.SwoftyPacket;
45

6+
@Getter
57
public class AnticheatPacketEvent {
68
private final SwoftyPacket packet;
79

810
public AnticheatPacketEvent(SwoftyPacket packet) {
911
this.packet = packet;
1012
}
1113

12-
public SwoftyPacket getPacket() {
13-
return packet;
14-
}
1514
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package net.swofty.anticheat.event.packet;
22

3+
import lombok.Getter;
34
import net.swofty.anticheat.engine.SwoftyPlayer;
45

6+
@Getter
57
public class IsOnGroundPacket extends SwoftyPacket {
6-
private boolean onGround;
8+
private final boolean onGround;
79

810
public IsOnGroundPacket(SwoftyPlayer player, boolean onGround) {
911
super(player);
1012
this.onGround = onGround;
1113
}
1214

13-
public boolean isOnGround() {
14-
return onGround;
15-
}
1615
}

anticheat/src/main/java/net/swofty/anticheat/event/packet/PingResponsePacket.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
@Getter
77
public class PingResponsePacket extends SwoftyPacket {
8-
private long requestId;
8+
private final long requestId;
99

1010
public PingResponsePacket(SwoftyPlayer player, long requestId) {
1111
super(player);
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
package net.swofty.anticheat.event.packet;
22

3+
import lombok.Getter;
34
import net.swofty.anticheat.engine.SwoftyPlayer;
45
import net.swofty.anticheat.math.Pos;
56

7+
@Getter
68
public class PositionAndRotationPacket extends SwoftyPacket {
7-
private Pos pos;
8-
private boolean onGround;
9+
private final Pos pos;
10+
private final boolean onGround;
911

1012
public PositionAndRotationPacket(SwoftyPlayer player, Pos pos, boolean onGround) {
1113
super(player);
1214
this.pos = pos;
1315
this.onGround = onGround;
1416
}
1517

16-
public Pos getPos() {
17-
return pos;
18-
}
19-
20-
public boolean isOnGround() {
21-
return onGround;
22-
}
2318
}
Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package net.swofty.anticheat.event.packet;
22

3+
import lombok.Getter;
34
import net.swofty.anticheat.engine.SwoftyPlayer;
45
import org.jetbrains.annotations.NotNull;
56

7+
@Getter
68
public class PositionPacket extends SwoftyPacket {
7-
private double x;
8-
private double y;
9-
private double z;
10-
private boolean onGround;
9+
private final double x;
10+
private final double y;
11+
private final double z;
12+
private final boolean onGround;
1113

1214
public PositionPacket(@NotNull SwoftyPlayer player, double x, double y, double z, boolean onGround) {
1315
super(player);
@@ -16,20 +18,4 @@ public PositionPacket(@NotNull SwoftyPlayer player, double x, double y, double z
1618
this.z = z;
1719
this.onGround = onGround;
1820
}
19-
20-
public double getX() {
21-
return x;
22-
}
23-
24-
public double getY() {
25-
return y;
26-
}
27-
28-
public double getZ() {
29-
return z;
30-
}
31-
32-
public boolean isOnGround() {
33-
return onGround;
34-
}
3521
}
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package net.swofty.anticheat.event.packet;
22

3+
import lombok.Getter;
34
import net.swofty.anticheat.engine.SwoftyPlayer;
45

6+
@Getter
57
public class RotationPacket extends SwoftyPacket {
6-
private float yaw;
7-
private float pitch;
8-
private boolean onGround;
8+
private final float yaw;
9+
private final float pitch;
10+
private final boolean onGround;
911

1012
public RotationPacket(SwoftyPlayer player, float yaw, float pitch, boolean onGround) {
1113
super(player);
@@ -14,15 +16,4 @@ public RotationPacket(SwoftyPlayer player, float yaw, float pitch, boolean onGro
1416
this.onGround = onGround;
1517
}
1618

17-
public float getYaw() {
18-
return yaw;
19-
}
20-
21-
public float getPitch() {
22-
return pitch;
23-
}
24-
25-
public boolean isOnGround() {
26-
return onGround;
27-
}
2819
}

0 commit comments

Comments
 (0)