VeroxCode / Guardian-AntiCheat

GNU Lesser General Public License v3.0
20 stars 4 forks source link

Anti clip #4

Closed SillierShark195 closed 1 year ago

SillierShark195 commented 1 year ago

Make player cant glitch inside block and block pearl in depend block

VeroxCode commented 1 year ago

This is nothing that belongs in an AntiCheat. Won't be added.

SillierShark195 commented 1 year ago

Wym there a phase hack?

VeroxCode commented 1 year ago

Should have specified more clearly what you meant

SillierShark195 commented 1 year ago

When cheater use phase he will teleport back out of the block.phase hack make you can glitch thru block

xqwtxon commented 1 year ago
        public function onMove(PlayerMoveEvent $event) {
                $id = $event->getPlayer()->getWorld()->getBlock($event->getPlayer()->getLocation())->getTypeId();
                if ($event->getPlayer()->getWorld()->getBlock($event->getPlayer()->getLocation()->add(0, 1, 0))->isSolid() && $event->getPlayer()->getGamemode() !== GameMode::SPECTATOR()) {
                        switch($id){
                                // Anti-false positive on falling blocks
                                case BlockTypeIds::SAND:
                                case BlockTypeIds::GRAVEL:
                                // Prevent false positive on fence & fence gates
                                case BlockTypeIds::ACACIA_FENCE:
                                case BlockTypeIds::OAK_FENCE:
                                case BlockTypeIds::BIRCH_FENCE:
                                case BlockTypeIds::DARK_OAK_FENCE:
                                case BlockTypeIds::JUNGLE_FENCE:
                                case BlockTypeIds::NETHER_BRICK_FENCE:
                                case BlockTypeIds::SPRUCE_FENCE:
                                case BlockTypeIds::WARPED_FENCE:
                                case BlockTypeIds::MANGROVE_FENCE:
                                case BlockTypeIds::CRIMSON_FENCE:
                                case BlockTypeIds::CHERRY_FENCE:
                                case BlockTypeIds::ACACIA_FENCE_GATE:
                                case BlockTypeIds::OAK_FENCE_GATE:
                                case BlockTypeIds::BIRCH_FENCE_GATE:
                                case BlockTypeIds::DARK_OAK_FENCE_GATE:
                                case BlockTypeIds::JUNGLE_FENCE_GATE:
                                case BlockTypeIds::SPRUCE_FENCE_GATE:
                                case BlockTypeIds::WARPED_FENCE_GATE:
                                case BlockTypeIds::MANGROVE_FENCE_GATE:
                                case BlockTypeIds::CRIMSON_FENCE_GATE:
                                case BlockTypeIds::CHERRY_FENCE_GATE:
                                // prevent glitching on cobblestone walls
                                case BlockTypeIds::COBBLESTONE_WALL:
                                // Prevent false positive on glass panes and building blocks.
                                case BlockTypeIds::GLASS_PANE:
                                case BlockTypeIds::HARDENED_GLASS_PANE:
                                case BlockTypeIds::STAINED_GLASS_PANE:
                                case BlockTypeIds::STAINED_HARDENED_GLASS_PANE:
                                // Prevent false positive on trapdoors
                                case BlockTypeIds::COBWEB:
                                case BlockTypeIds::ACACIA_TRAPDOOR:
                                case BlockTypeIds::OAK_TRAPDOOR:
                                case BlockTypeIds::BIRCH_TRAPDOOR:
                                case BlockTypeIds::DARK_OAK_TRAPDOOR:
                                case BlockTypeIds::JUNGLE_TRAPDOOR:
                                case BlockTypeIds::SPRUCE_TRAPDOOR:
                                case BlockTypeIds::WARPED_TRAPDOOR:
                                case BlockTypeIds::MANGROVE_TRAPDOOR:
                                case BlockTypeIds::CRIMSON_TRAPDOOR:
                                case BlockTypeIds::CHERRY_TRAPDOOR:
                                case BlockTypeIds::CARPET:
                                case BlockTypeIds::CACTUS:
                                case BlockTypeIds::BELL:
                                case BlockTypeIds::BED:
                                        break;
                                default:
                                        $event->cancel();
                                        $this->fail($event->getPlayer());
                                break;
                        }
                        return;
                }
        }

Retrieved from: on my old anticheat project, feel free to use the code

Might helpful, illustrating noclip hacks, remember: checking them first if they are swimming, because it may cause false-positives.