-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
358 additions
and
76 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
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
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
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
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
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
69 changes: 69 additions & 0 deletions
69
src/main/java/com/justdoom/flappyanticheat/checks/movement/speed/SpeedA.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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.justdoom.flappyanticheat.checks.movement.speed; | ||
|
||
import com.justdoom.flappyanticheat.checks.Check; | ||
import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent; | ||
import io.github.retrooper.packetevents.packettype.PacketType; | ||
import io.github.retrooper.packetevents.packetwrappers.play.in.flying.WrappedPacketInFlying; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
|
||
public class SpeedA extends Check { | ||
|
||
private int onGroundTime = 0; | ||
private boolean lastOnGround; | ||
|
||
public SpeedA(){ | ||
super("Speed", "A", true); | ||
} | ||
|
||
@Override | ||
public void onPacketPlayReceive(PacketPlayReceiveEvent event) { | ||
if(event.getPacketId() == PacketType.Play.Client.POSITION){ | ||
WrappedPacketInFlying packet = new WrappedPacketInFlying(event.getNMSPacket()); | ||
Player player = event.getPlayer(); | ||
|
||
double deltaX = packet.getX() - player.getLocation().getX(); | ||
double deltaZ = packet.getZ() - player.getLocation().getZ(); | ||
|
||
double deltaXZ = Math.hypot(deltaX, deltaZ); | ||
|
||
boolean onGround = packet.isOnGround(); | ||
boolean lastOnGround = this.lastOnGround; | ||
this.lastOnGround = onGround; | ||
|
||
if(deltaXZ > 0.4) { | ||
//player.sendMessage(String.valueOf(deltaXZ)); | ||
} | ||
|
||
/**double distX = packet.getX() - player.getLocation().getX(); | ||
double distZ = packet.getZ() - player.getLocation().getZ(); | ||
double dist = (distX * distX) + (distZ * distZ); | ||
double lastDist = this.lastDist; | ||
this.lastDist = dist; | ||
boolean onGround = packet.isOnGround(); | ||
boolean lastOnGround = this.lastOnGround; | ||
this.lastOnGround = onGround; | ||
float friction = 0.91F; | ||
double shiftedLastDist = lastDist * friction; | ||
double equalness = dist - shiftedLastDist; | ||
double scaledEqualness = equalness * 138; | ||
if(!onGround && !lastOnGround){ | ||
if(scaledEqualness >= 1.0){ | ||
Bukkit.broadcastMessage(String.valueOf(scaledEqualness)); | ||
} | ||
} | ||
if(packet.isOnGround()){ | ||
onGroundTime++; | ||
} | ||
if(onGroundTime >= 15){ | ||
//double expected = thisMove / data.getGroundTime() + baseMove; | ||
}**/ | ||
} | ||
} | ||
} |
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
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
49 changes: 49 additions & 0 deletions
49
src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceA.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.justdoom.flappyanticheat.checks.player.blockplace; | ||
|
||
import com.justdoom.flappyanticheat.FlappyAnticheat; | ||
import com.justdoom.flappyanticheat.checks.Check; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Material; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.block.BlockFace; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.block.BlockPlaceEvent; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class BlockPlaceA extends Check implements Listener { | ||
|
||
public BlockPlaceA() { | ||
super("BlockPlace", "A", true); | ||
} | ||
|
||
@EventHandler | ||
public void onBlockPlace(BlockPlaceEvent event) { | ||
Player player = event.getPlayer(); | ||
|
||
Block block = event.getBlock(); | ||
boolean placedOnAir = true; | ||
|
||
List<Material> blockFace = new ArrayList<Material>() {{ | ||
add(block.getRelative(BlockFace.UP).getType()); | ||
add(block.getRelative(BlockFace.NORTH).getType()); | ||
add(block.getRelative(BlockFace.EAST).getType()); | ||
add(block.getRelative(BlockFace.SOUTH).getType()); | ||
add(block.getRelative(BlockFace.WEST).getType()); | ||
add(block.getRelative(BlockFace.DOWN).getType()); | ||
}}; | ||
|
||
for (Material material : blockFace) { | ||
if (material != Material.AIR && material != Material.LAVA && material != Material.WATER && material != Material.CAVE_AIR && material != Material.VOID_AIR) { | ||
placedOnAir = false; | ||
break; | ||
} | ||
} | ||
if (placedOnAir) { | ||
Bukkit.getScheduler().runTaskAsynchronously(FlappyAnticheat.getInstance(), () -> fail("faces=" + blockFace, player)); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/justdoom/flappyanticheat/checks/player/blockplace/BlockPlaceB.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.justdoom.flappyanticheat.checks.player.blockplace; | ||
|
||
import com.justdoom.flappyanticheat.FlappyAnticheat; | ||
import com.justdoom.flappyanticheat.checks.Check; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.event.block.BlockPlaceEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
public class BlockPlaceB extends Check implements Listener { | ||
|
||
public BlockPlaceB() { | ||
super("BlockPlace", "B", true); | ||
} | ||
|
||
@EventHandler | ||
public void onBlockPlace(BlockPlaceEvent event) { | ||
Player player = event.getPlayer(); | ||
|
||
Block block = event.getBlock(); | ||
|
||
ItemStack hand = player.getItemInHand(); | ||
|
||
if (block.getType() != hand.getType()) { | ||
Bukkit.getScheduler().runTaskAsynchronously(FlappyAnticheat.getInstance(), () -> fail("hand=" + hand.getType() + " placed=" + block.getType(), player)); | ||
} | ||
} | ||
} |
Oops, something went wrong.