Skip to content

Commit 4ff5e43

Browse files
committed
1.7.6 BETA release
1 parent afb83e1 commit 4ff5e43

6 files changed

Lines changed: 96 additions & 1 deletion

File tree

pom.xml

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

77
<groupId>com.justdoom</groupId>
88
<artifactId>FlappyAnticheat</artifactId>
9-
<version>1.7.5-BETA</version>
9+
<version>1.7.6-BETA</version>
1010
<packaging>jar</packaging>
1111

1212
<name>FlappyAnticheat</name>

src/main/java/com/justdoom/flappyanticheat/checks/CheckManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.justdoom.flappyanticheat.FlappyAnticheat;
44
import com.justdoom.flappyanticheat.checks.combat.forcefield.ForcefieldA;
55
import com.justdoom.flappyanticheat.checks.combat.reach.ReachA;
6+
import com.justdoom.flappyanticheat.checks.movement.boatfly.BoatFlyA;
67
import com.justdoom.flappyanticheat.checks.movement.fly.FlyA;
78
import com.justdoom.flappyanticheat.checks.movement.fly.FlyB;
89
import com.justdoom.flappyanticheat.checks.movement.groundspoof.GroundSpoofA;
@@ -45,6 +46,7 @@ public void loadChecks(){
4546
PacketEvents.get().registerListener(new ForcefieldA());
4647
PacketEvents.get().registerListener(new ReachA());
4748
PacketEvents.get().registerListener(new InventoryA());
49+
PacketEvents.get().registerListener(new BoatFlyA());
4850

4951
Bukkit.getPluginManager().registerEvents(new BlockPlaceA(), plugin);
5052
Bukkit.getPluginManager().registerEvents(new BlockPlaceB(), plugin);
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package com.justdoom.flappyanticheat.checks.movement.boatfly;
2+
3+
import com.justdoom.flappyanticheat.checks.Check;
4+
import com.justdoom.flappyanticheat.utils.PlayerUtil;
5+
import com.justdoom.flappyanticheat.utils.ServerUtil;
6+
import io.github.retrooper.packetevents.PacketEvents;
7+
import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent;
8+
import io.github.retrooper.packetevents.packettype.PacketType;
9+
import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying;
10+
import org.bukkit.Location;
11+
import org.bukkit.Material;
12+
import org.bukkit.block.Block;
13+
import org.bukkit.entity.EntityType;
14+
import org.bukkit.entity.Player;
15+
16+
import java.util.HashMap;
17+
import java.util.Map;
18+
import java.util.UUID;
19+
20+
public class BoatFlyA extends Check {
21+
22+
private Map<UUID, Double> airTicks = new HashMap<>();
23+
24+
private Map<UUID, Boolean> inAir = new HashMap<>();
25+
26+
private Map<UUID, Double> y = new HashMap<>();
27+
28+
private Map<UUID, Double> lastY = new HashMap<>();
29+
30+
public BoatFlyA(){
31+
super("BoatFly", "A", false);
32+
}
33+
34+
@Override
35+
public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
36+
37+
Player player = event.getPlayer();
38+
UUID uuid = player.getUniqueId();
39+
40+
double airTicks = this.airTicks.getOrDefault(uuid, 0.0);
41+
boolean inAir = this.inAir.getOrDefault(uuid, false);
42+
43+
//measuring how many ticks the player has an air block below them for
44+
airTicks = inAir ? airTicks + 1 : 0;
45+
46+
this.airTicks.put(uuid, airTicks);
47+
48+
if (event.getPacketId() == PacketType.Play.Client.VEHICLE_MOVE) {
49+
50+
lastY.put(uuid, y.getOrDefault(uuid, 0.0));
51+
y.put(uuid, player.getLocation().getY());
52+
53+
//dont run the check if they have /fly on or are creative flying
54+
if (player.isFlying() || player.isGliding()) return;
55+
56+
if(ServerUtil.lowTPS(("checks." + check + "." + checkType).toLowerCase()))
57+
return;
58+
59+
//check if the blocks below the player are air blocks. not entirely accurate.
60+
for (Block block : PlayerUtil.getNearbyBlocksHorizontally(new Location(player.getWorld(),
61+
player.getLocation().getX(), player.getLocation().getY() - 1, player.getLocation().getZ()), 1)) {
62+
if (block.getType() != Material.AIR) {
63+
this.inAir.put(uuid, false);
64+
break;
65+
} else {
66+
this.inAir.put(uuid, true);
67+
}
68+
}
69+
70+
player.sendMessage(String.valueOf(y.getOrDefault(uuid, 0.0)));
71+
player.sendMessage(String.valueOf(lastY.getOrDefault(uuid, 0.0)));
72+
if(player.isInsideVehicle() && airTicks > 10
73+
&& y.getOrDefault(uuid, 0.0) > 1 + lastY.getOrDefault(uuid, 0.0)
74+
&& player.getVehicle().getType() == EntityType.BOAT) {
75+
fail("", player);
76+
}
77+
}
78+
}
79+
}

src/main/java/com/justdoom/flappyanticheat/checks/movement/groundspoof/GroundSpoofA.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public void onPacketPlayReceive(PacketPlayReceiveEvent e) {
6767
AtomicReference<List<Entity>> nearby = new AtomicReference<>();
6868
sync(() -> nearby.set(data.entities));
6969

70+
if(nearby.get() == null) return;
71+
7072
for (Entity entity : nearby.get()) {
7173
if (entity.getType() == EntityType.BOAT && player.getLocation().getY() > entity.getLocation().getY()) {
7274
boat = true;

src/main/java/com/justdoom/flappyanticheat/checks/movement/speed/SpeedA.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public void onPacketPlayReceive(PlayerMoveEvent event) {
3030
Player player = event.getPlayer();
3131
PlayerData data = FlappyAnticheat.getInstance().dataManager.getData(event.getPlayer().getUniqueId());
3232

33+
//dont run the check if they have /fly on or are creative flying
34+
if (player.isFlying() || player.isGliding()) return;
3335
if(PacketEvents.get().getPlayerUtils().isGeyserPlayer(event.getPlayer().getPlayer())) return;
3436

3537
//pos stuff

src/main/resources/config.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ checks:
4040
punish-commands:
4141
- "kick {player} FlappyAC > Suspicious Activity"
4242
vl: 20
43+
boatfly:
44+
a:
45+
enabled: true
46+
min-tps: 17.0
47+
punishable: true
48+
broadcast-punishment: true
49+
punish-vl: 200
50+
punish-commands:
51+
- "kick {player} FlappyAC > Suspicious Activity"
52+
vl: 20
4353
fly:
4454
a:
4555
enabled: true

0 commit comments

Comments
 (0)