Skip to content

Commit

Permalink
Merge pull request #4 from Pixchure/main
Browse files Browse the repository at this point in the history
Added a KillAura check. May need some tweaks
  • Loading branch information
JustDoom authored May 18, 2021
2 parents 592b7cd + 84e98b2 commit 274a03c
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import com.justdoom.flappyanticheat.checks.player.blockplace.BlockPlaceA;
import com.justdoom.flappyanticheat.checks.player.badpackets.BadPacketsA;
import com.justdoom.flappyanticheat.checks.player.badpackets.BadPacketsB;
import com.justdoom.flappyanticheat.checks.combat.killaura.KillAuraA;
import com.justdoom.flappyanticheat.checks.combat.autoclicker.AutoClickerA;
import com.justdoom.flappyanticheat.data.PlayerData;
import com.justdoom.flappyanticheat.checks.player.blockplace.BlockPlaceB;
import com.justdoom.flappyanticheat.checks.player.skinblinker.SkinBlinkerA;
import io.github.retrooper.packetevents.PacketEvents;
Expand All @@ -25,10 +28,13 @@ public void loadChecks(){
PacketEvents.get().registerListener(new FlyA());
PacketEvents.get().registerListener(new BadPacketsA());
PacketEvents.get().registerListener(new BadPacketsB());
PacketEvents.get().registerListener(new NoSlowA());
PacketEvents.get().registerListener(new AutoClickerA());
PacketEvents.get().registerListener(new KillAuraA());
PacketEvents.get().registerListener(new SkinBlinkerA());
PacketEvents.get().registerListener(new SpeedA());

Bukkit.getPluginManager().registerEvents(new BlockPlaceA(), plugin);
Bukkit.getPluginManager().registerEvents(new BlockPlaceB(), plugin);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

package com.justdoom.flappyanticheat.checks.combat.killaura;

import com.justdoom.flappyanticheat.checks.Check;
import com.justdoom.flappyanticheat.data.PlayerData;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayInArmAnimation;
import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import org.bukkit.entity.Player;

/**
* ported by pixchure
*
*/

public class AutoClickerA extends Check {

private int swings;
private int movements;

public AutoClickerA(PlayerData playerData) {
super("AutoClicker", "A", true);
}

@Override
public void handleCheck(Player player, Packet packet) {
//double vl = playerData.getCheckVl(this);

if (packet instanceof PacketPlayInArmAnimation
&& !playerData.isDigging() && !playerData.isPlacing() && !playerData.isFakeDigging()
&& (System.currentTimeMillis() - playerData.getLastDelayedMovePacket()) > 220L
&& (System.currentTimeMillis() - playerData.getLastMovePacket().getTimestamp()) < 110L) {
++swings;
} else if (packet instanceof PacketPlayInFlying && ++movements == 20) {
if (swings > 35) {
fail("", player);
}
movements = swings = 0;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.justdoom.flappyanticheat.checks.combat.killaura;

import com.justdoom.flappyanticheat.checks.Check;
import com.justdoom.flappyanticheat.data.PlayerData;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayInArmAnimation;
import net.minecraft.server.v1_8_R3.PacketPlayInFlying;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import org.bukkit.entity.Player;

/**
* ported by Pixchure
* not even sure if this works
*/

public class KillAuraA extends Check {
private boolean sent;
public KillAuraA(){
super("KillAura", "A", false);
}

@Override
public void handleCheck(Player player, Packet packet) {
//double vl = playerData.getCheckVl(this);

if (playerData.getPing() > 70) {
return;
}

if (packet instanceof PacketPlayInUseEntity && ((PacketPlayInUseEntity) packet).a() == PacketPlayInUseEntity
.EnumEntityUseAction.ATTACK) {
if (!sent) {
fail("", player)
} else {
sent = false;
}
} else if (packet instanceof PacketPlayInArmAnimation) {
sent = true;
} else if (packet instanceof PacketPlayInFlying) {
sent = false;
}
//playerData.setCheckVl(vl, this);
}
}
10 changes: 5 additions & 5 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ checks:
broadcast-punishment: true
punish-vl: 200
punish-commands:
- "kick {player} GroundSpoof A"
- "kick {player} FlappyAC > Suspicious Activity"
vl: 20
fly:
a:
Expand All @@ -45,7 +45,7 @@ checks:
broadcast-punishment: true
punish-vl: 200
punish-commands:
- "kick {player} Fly A"
- "kick {player} FlappyAC > Suspicious Activity"
vl: 15
badpackets:
a:
Expand All @@ -54,15 +54,15 @@ checks:
broadcast-punishment: true
punish-vl: 10
punish-commands:
- "kick {player} BadPackets A"
- "kick {player} FlappyAC > Suspicious Activity"
vl: 10
b:
enabled: true
punishable: true
broadcast-punishment: true
punish-vl: 200
punish-commands:
- "kick {player} BadPackets A"
- "kick {player} FlappyAC > Suspicious Activity"
vl: 10
skinblinker:
a:
Expand All @@ -72,4 +72,4 @@ checks:
punish-vl: 100
punish-commands:
- "kick {player} SkinBlinker A"
vl: 10
vl: 10

0 comments on commit 274a03c

Please sign in to comment.