anshu_here07

make a plugin name AntiFreeCam feature Anti-Freecam

Detect and prevent freecam exploits.

Block opening chests, shulkers and containers through walls.

Prevent breaking or placing blocks outside legitimate reach.

Detect suspicious block interactions.

Anti-ESP

Protect hidden mobs, villagers and entities from ESP.

Prevent unnecessary hidden entity data from reaching players.

Add configurable entity protection.

Anti-Xray / Underground Protection

Hide ALL ore types below Y-level 32.

Protect diamond, emerald, iron, gold, coal, copper, redstone, lapis, ancient debris and all other ores.

Use optimized packet-level block obfuscation or Paper Anti-Xray.

Reveal correct blocks when legitimately exposed through mining.

Make the protected Y-level configurable.

Punishment System

Violation detection and levels.

Warnings, kicks and configurable temporary bans.

Staff alerts with player name and detection reason.

Commands

/scytheac

/scytheac reload

/scytheac alerts

/scytheac info <player>

/scytheac bypass <player>

Configuration

Separate toggles for Freecam, ESP and Anti-Xray.

Configurable Y-level (default 32).

Custom punishments, messages and permissions.

Support multiple worlds.

Kodari AI
KodariNov 9 at 6:34 am 2
ScytheAntiCheat
ScytheAntiCheat is a comprehensive anti-cheat plugin that detects and prevents freecam exploits, ESP usage, and X-ray mining. It blocks container interactions through walls, prevents out-of-reach block manipulation, and protects hidden entities from ESP clients. The plugin obfuscates all ore types below a configurable Y-level using optimized packet-level block obfuscation. It features a violation-based punishment system with warnings, kicks, and temporary bans, plus staff alerts. Commands include /scytheac reload, alerts, info, and bypass. Configuration supports separate toggles for each protection module, custom punishments, messages, permissions, and multi-world support.
  • Add reach and line-of-sight checks, violation levels, punishments, and staff commands.

  • Add configurable entity visibility protection across selected worlds.

  • Leave ore packet obfuscation to Paper Anti-Xray; it requires server-side world configuration.

Created AntiFreeCam with interaction checks, entity visibility filtering, violation punishments, staff alerts, and /scytheac commands.

Limitations: Anti-Xray must be configured separately in Paper’s per-world settings; the plugin’s Y-level setting does not configure Paper. Entity visibility filtering is periodic, so it cannot guarantee that hidden entity data never reaches a player.

anshu_here07

we cant see block when we reach y level 35 there was air and all ores are spawner also

Kodari AI
KodariNov 9 at 6:42 am 1

AntiFreeCam does not modify block or chunk packets, so it cannot directly cause the air or spawner blocks. Its protected-y-level: 32 setting also does not configure Paper’s Anti-Xray.

Please send your Paper version and the anti-xray section from the affected world’s paper-world.yml, along with any other anti-xray plugins you use. That will help identify what’s sending the incorrect blocks.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 283
src/main/java/com/kodari/antifreecam/AntiFreeCam.java
package com.kodari.antifreecam;

import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;

import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public final class AntiFreeCam extends JavaPlugin implements Listener {
    private final Map<UUID, Integer> violations = new HashMap<>();
    private final Set<UUID> bypass = new HashSet<>();
    private final Set<UUID> alerts = new HashSet<>();
    private final Map<UUID, Set<UUID>> hidden = new HashMap<>();
    private BukkitTask visibilityTask;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        getServer().getPluginManager().registerEvents(this, this);
        startVisibilityTask();
        if (getConfig().getBoolean("anti-xray.enabled", true)) {
            getLogger().warning("Anti-Xray must be configured in Paper's per-world configuration; this plugin does not obfuscate chunk packets.");
        }
    }

    @Override
    public void onDisable() {
        restoreEntities();
    }

    private String permission(String key, String fallback) {
        return getConfig().getString("permissions." + key, fallback);
    }

    private boolean protectedWorld(World world) {
        java.util.List<String> worlds = getConfig().getStringList("worlds");
        return worlds.isEmpty() || worlds.contains(world.getName());
    }

    private boolean exempt(Player player) {
        return bypass.contains(player.getUniqueId()) || player.hasPermission(permission("bypass", "scytheac.bypass"));
    }

    private String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }

    private void send(CommandSender sender, String message) {
        sender.sendMessage(color(getConfig().getString("messages.prefix", "&8[&bAntiFreeCam&8] &r") + message));
    }

    private boolean invalidInteraction(Player player, Block target) {
        if (!getConfig().getBoolean("freecam.enabled", true) || !protectedWorld(player.getWorld()) || exempt(player)) return false;
        Location eye = player.getEyeLocation();
        double reach = Math.max(1.0, getConfig().getDouble("freecam.reach", 6.0));
        double x = Math.max(target.getX(), Math.min(eye.getX(), target.getX() + 1.0));
        double y = Math.max(target.getY(), Math.min(eye.getY(), target.getY() + 1.0));
        double z = Math.max(target.getZ(), Math.min(eye.getZ(), target.getZ() + 1.0));
        if (eye.distanceSquared(new Location(target.getWorld(), x, y, z)) > reach * reach) {
            flag(player, "reach");
            return true;
        }
        Vector direction = target.getLocation().add(0.5, 0.5, 0.5).toVector().subtract(eye.toVector());
        double distance = direction.length();
        if (distance > 0.0) {
            RayTraceResult hit = player.getWorld().rayTraceBlocks(eye, direction, distance);
            if (hit != null && hit.getHitBlock() != null && !hit.getHitBlock().equals(target)) {
                flag(player, "interaction through a block");
                return true;
            }
        }
        return false;
    }

    @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    public void onInteract(PlayerInteractEvent event) {
        Block block = event.getClickedBlock();
        if (block != null && invalidInteraction(event.getPlayer(), block)) event.setCancelled(true);
    }

    @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    public void onBreak(BlockBreakEvent event) {
        if (invalidInteraction(event.getPlayer(), event.getBlock())) event.setCancelled(true);
    }

    @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
    public void onPlace(BlockPlaceEvent event) {
        if (invalidInteraction(event.getPlayer(), event.getBlockAgainst())) event.setCancelled(true);
    }

    private void flag(Player player, String reason) {
        int level = violations.merge(player.getUniqueId(), 1, Integer::sum);
        String alert = getConfig().getString("messages.alert", "&e%player% &7failed &c%reason% &7(VL %vl%).")
                .replace("%player%", player.getName()).replace("%reason%", reason).replace("%vl%", Integer.toString(level));
        for (Player staff : Bukkit.getOnlinePlayers()) {
            if (staff.hasPermission(permission("alerts", "scytheac.alerts")) && alerts.contains(staff.getUniqueId())) send(staff, alert);
        }
        int ban = getConfig().getInt("violations.temporary-ban", 10);
        int kick = getConfig().getInt("violations.kick", 6);
        int warning = getConfig().getInt("violations.warning", 3);
        if (ban > 0 && level >= ban) {
            String message = color(getConfig().getString("messages.ban", "&cTemporarily banned for suspicious interactions."));
            long minutes = Math.max(1, getConfig().getLong("violations.ban-minutes", 30));
            Bukkit.getBanList(BanList.Type.NAME).addBan(player.getName(), ChatColor.stripColor(message), new Date(System.currentTimeMillis() + minutes * 60000L), "AntiFreeCam");
            violations.remove(player.getUniqueId());
            player.kickPlayer(message);
        } else if (kick > 0 && level == kick) {
            player.kickPlayer(color(getConfig().getString("messages.kick", "&cToo many suspicious interactions.")));
        } else if (warning > 0 && level == warning) {
            send(player, getConfig().getString("messages.warning", "&cSuspicious interaction detected. Violations: %vl%.").replace("%vl%", Integer.toString(level)));
        }
    }

    private void startVisibilityTask() {
        if (visibilityTask != null) visibilityTask.cancel();
        restoreEntities();
        if (!getConfig().getBoolean("esp.enabled", true)) return;
        long interval = Math.max(1, getConfig().getLong("esp.update-ticks", 20));
        visibilityTask = Bukkit.getScheduler().runTaskTimer(this, this::updateVisibility, 1L, interval);
    }

    private void updateVisibility() {
        Set<String> types = new HashSet<>(getConfig().getStringList("esp.entity-types"));
        for (Player viewer : Bukkit.getOnlinePlayers()) {
            Set<UUID> current = new HashSet<>();
            if (protectedWorld(viewer.getWorld()) && !exempt(viewer)) {
                for (Entity entity : viewer.getWorld().getEntities()) {
                    if (!(entity instanceof LivingEntity) || entity instanceof Player || !types.contains(entity.getType().name())) continue;
                    if (!viewer.hasLineOfSight(entity)) {
                        viewer.hideEntity(this, entity);
                        current.add(entity.getUniqueId());
                    }
                }
            }
            Set<UUID> previous = hidden.getOrDefault(viewer.getUniqueId(), java.util.Collections.emptySet());
            for (UUID id : previous) {
                if (!current.contains(id)) {
                    Entity entity = Bukkit.getEntity(id);
                    if (entity != null) viewer.showEntity(this, entity);
                }
            }
            hidden.put(viewer.getUniqueId(), current);
        }
    }

    private void restoreEntities() {
        for (Map.Entry<UUID, Set<UUID>> entry : hidden.entrySet()) {
            Player player = Bukkit.getPlayer(entry.getKey());
            if (player == null) continue;
            for (UUID id : entry.getValue()) {
                Entity entity = Bukkit.getEntity(id);
                if (entity != null) player.showEntity(this, entity);
            }
        }
        hidden.clear();
    }

    @EventHandler
    public void onQuit(PlayerQuitEvent event) {
        alerts.remove(event.getPlayer().getUniqueId());
        hidden.remove(event.getPlayer().getUniqueId());
    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (args.length == 1 && args[0].equalsIgnoreCase("alerts")) {
            if (!(sender instanceof Player)) { send(sender, "&cOnly players can toggle alerts."); return true; }
            if (!sender.hasPermission(permission("alerts", "scytheac.alerts"))) { send(sender, "&cNo permission."); return true; }
            UUID id = ((Player) sender).getUniqueId();
            if (!alerts.add(id)) { alerts.remove(id); send(sender, "&7Alerts disabled."); }
            else send(sender, "&aAlerts enabled.");
            return true;
        }
        if (!sender.hasPermission(permission("admin", "scytheac.admin"))) { send(sender, "&cNo permission."); return true; }
        if (args.length == 1 && args[0].equalsIgnoreCase("reload")) {
            reloadConfig();