Anti-Dupe Script (Behaviour Pack)
This Anti-Dupe Script is a server-side mitigation pack for common duplication exploit outcomes and near-player setups in Minecraft Bedrock Edition. It is designed to work across Worlds, Realms, and Servers, focusing on player-centric scanning (near active players) and immediate mitigation (remove/clear/eject invalid or restricted states).
Primary coverage:
- Join-Leave (Ghost Stack) Dupe
- Tall Plant / Piston Dupe
- Bundle-style transfer dupes (via Hoppers and Droppers)
Additional optional hardening included:
- Illegal stack size enforcement (clears impossible/invalid stacks; enforces a hard cap of 64)
Coverage reminder: Plant / hopper / dropper checks scan only a small cube around each player (
SCAN_RADIUS = 4). If nobody is near a setup, it will not be scanned.
No Experiments Required
This pack targets the stable Script API modules (@minecraft/server and @minecraft/server-ui) and does not require enabling Beta APIs or other experimental toggles when you reference stable module versions in your manifest.
Important note: Your host/world must still allow scripting to run (some hosting panels have an “Enable Scripts” toggle), but this is distinct from enabling experimental gameplay features.
UI & Screenshots
Overview / Main Menu

Settings / Configuration

Logs / Incident Log Viewer

Punishments / Global Options

Debug

Help

Violations Dashboard / Leaderboard

Restricted Items Manager

Violation Registry / Player Detail View

Public Chat Alert Example

Admin Alert Example

Quick Start (Server Owners)
- Install the pack as a Behaviour Pack on your Bedrock world/server.
- Ensure the Script API modules are available (
@minecraft/server+@minecraft/server-ui). - Open the Anti-Dupe UI (how you access it depends on how you wired the pack into your world).
- Confirm the protections you want are enabled under Settings → Configuration (World).
The pack includes
SETTINGS_ITEM = minecraft:bedrockas a default constant used for “open menu” integration, but the exact trigger (item, command, NPC, etc.) depends on your wiring.
In-Game Tags (Players & Staff)
Make someone an Admin (receives admin alerts, excluded from punishments)
/tag <player> add Admin
Let a player opt out of public Anti-Dupe chat messages
/tag <player> add antidupe:disable_public_msg
Let an Admin opt out of admin alerts
/tag <player> add antidupe:disable_admin_msg
Let an Admin opt out of all Anti-Dupe alerts (public + admin)
/tag <player> add antidupe:disable_alert
These tags are safe to manage in-game at any time. Changes apply immediately.
Adding / Managing Restricted Items (In-Game)
The hopper and dropper protections use a Restricted Items list.
What it does
- Hoppers: restricted items are removed from the hopper inventory.
- Droppers: restricted items are ejected into the world and removed from the dropper inventory.
How to add items
Use Settings → Restricted Items (UI).
- Accepts item IDs (case-insensitive)
- Sanitises IDs into
namespace:itemformat where possible - Capped at 90 entries
Restricted Items Manager

Default restricted list targets bundles and their variants (e.g.,
minecraft:bundle,minecraft:red_bundle, etc.).
What This Script Detects & Mitigates
This section reflects current behaviour while remaining readable for server owners.
1) Join-Leave Dupe Protection (Ghost Stack)
When it runs: On initial spawn (playerSpawn with initialSpawn === true).
What it checks (simplified):
- The player has a full stack on the cursor (not a normal inventory slot)
- Their inventory has no empty slots
What it does:
- Drops 1 item of that type at the player
- Clears the cursor stack
- Logs:
Ghost Stack Dupe(mode: attempted)
Ghost Stack Mitigation Result

Developer detail (exact checks):
- Cursor item:
held.amount === held.maxAmount - Inventory empty slots:
emptySlotsCount === 0
2) Illegal Stack Size Enforcement
When it runs: Every ILLEGAL_STACK_SCAN_TICKS = 40 ticks (~2 seconds at 20 TPS) per player.
What it removes:
- Non-finite stack amounts
amount <= 0amount > stack.maxAmount- Any stack above 64 (hard cap enforced by the script)
What it does:
- Clears illegal stacks from inventory + cursor
- Logs:
Illegal Stack Size(mode: detected)
Compatibility note: If you intentionally run mechanics that allow stacks above 64, this feature will conflict.
3) Tall Plant / Piston Dupe Protection
When it runs: In the player-centric scanner (near players only).
What it targets:
- Two-high plants (tall grass, large fern, sunflower, rose bush, lilac, peony, tall seagrass, etc.)
- Pistons/sticky pistons placed close to these plants (common “near-player setup” pattern)
What it does:
- Searches nearby for pistons at distances 1–2 blocks in 8 directions
- Removes the piston (direct set when possible; otherwise falls back to
setblock) - Logs:
Piston Dupe(mode: attempted)
Piston Removal Example

4) Restricted Item Removal in Hoppers
When it runs: In the player-centric scanner (near players only).
What it does:
- Scans nearby
minecraft:hopperinventories - Removes restricted items (clears slots)
- Logs:
Hopper Dupe(mode: attempted)
Hopper Removal Example

5) Restricted Item Ejection from Droppers
When it runs: In the player-centric scanner (near players only).
What it does:
- Scans nearby
minecraft:dropperinventories - For each restricted stack:
- Spawns it above the dropper (not destroyed)
- Clears the slot
- Logs:
Dropper Dupe(mode: attempted) with(Item Ejected)context
Dropper Ejection Example

Scanning Model (Performance & Coverage)
Player-Centric Scan Radius
- The scanner checks a 9×9×9 cube around each player:
dx, dy, dzfrom-4to+4around the player’s floored position
- Plant/hopper/dropper protections apply only inside that cube
Throttling / Work Budget
- The scanner runs as a generator with a per-tick budget:
BLOCKS_PER_TICK_LIMIT = 2000scan steps per tick (shared across all players)
- With many players, scans may take multiple ticks to cycle
Practical meaning: strongest coverage where players are active (spawn, bases, shops). This is not a global world scan.
Messaging & Alerts (What Players Will See)
Public Chat Alerts
Sent to everyone except players with antidupe:disable_public_msg.
Formats:
- Attempted:
<Anti-Dupe> <Player> attempted a <Incident Type> with <Item/Context>. - Detected:
<Anti-Dupe> <Player> was found with <Incident Type>: <Item/Context>. Item removed.
Public Chat Alert Example

In current behaviour, detected is used primarily by Illegal Stack Size. Most other protections emit attempted.
Admin Alerts
Sent to players with the Admin tag.
Admin opt-outs:
antidupe:disable_admin_msg(admin alerts only)antidupe:disable_alert(all alerts)
Admin alerts include:
- Incident phrasing (attempted/detected)
- Dimension + coordinates
- Nearby players within 50 blocks (max 12 names)
Admin Alert Example

Logs & Violation Tracking
Incident Logs
- In-memory rolling log: max 100 entries
- UI shows: 25 newest
- If Dynamic Properties are supported, logs persist under
antidupe:logs(size-capped; older entries dropped to fit)
Incident Log Viewer
Scoreboard Objectives (If Supported)
ad_total(per-player total)ad_ghostad_plantad_hopperad_dropperad_illegalad_otherad_global(global count stored under participant#global)
Persistent Registry (If Supported)
antidupe:vstatsstores high-level totals + “most recent” metadataviolations_dbstores per-player entries used by the punishments UI and kick-loop- Migrates legacy
violators_dbintoviolations_dbif found
Violations Dashboard / Leaderboard

Punishments (Optional, Configurable)
Punishments are driven by world configuration (antidupe:config when persistence is available).
Defaults (as shipped)
- Punishments: enabled
- Kicks: disabled by default (
allowKick: false) - Default thresholds:
- Ghost: 1
- Piston (plant): 1
- Hopper: 3
- Dropper: 3
- Illegal: 1
- Other: disabled
Punishments / Global Options

What punishments can do
Per dupe type (if enabled/configured):
- Apply a type-specific tag (optional)
- Apply a global punishment tag once threshold is reached (optional)
- Kick at threshold (only if
allowKick: trueand that type enables kicking) - Kick on repeat if already tagged (optional)
Safety / Bypass
- Admins are never punished (
Admintag is excluded). - A bypass tag can be configured (players with it are exempt).
- Kick attempts are throttled by a cooldown (
cooldownTicks).
Kick Loop (Persistent Enforcement)
The registry supports a kickLoop flag:
- When enabled for a player, they may be kicked on join at a configured interval
- Intended for repeat offenders
Violation Registry / Player Detail View

Kicking uses
/kick. Your environment must allow commands for kicks to succeed.
Compatibility / Requirements
Requires a Bedrock environment that supports:
@minecraft/server(server-side Script API)@minecraft/server-ui(Script UI)
Recommended (for best experience, but not required):
- Dynamic Properties (config + logs + violation registry persistence)
- Scoreboard API (per-player breakdowns / leaderboards)
Command-dependent behaviour:
- Piston removal may fall back to
setblockif direct block mutation is unavailable. - Kicks require
/kickto be allowed.
What This Pack Does Not Do
- It does not scan the entire world continuously (near-player scanning only).
- It does not strip restricted items from general storage (chests, barrels, etc.).
- It is not a guarantee against all dupes/exploits; it mitigates observable states/setups it can detect.
- It treats stacks above 64 as illegal and removes them.
Troubleshooting / FAQ
“Nothing is being detected.”
- Ensure players are near the suspected setup (scan radius is small).
- Verify protections are enabled in Settings → Configuration (World).
Settings / Configuration

“Admins are not receiving alerts.”
- Ensure staff have the
Admintag:/tag <player> add Admin - Check opt-out tags:
antidupe:disable_admin_msgantidupe:disable_alert
“Logs do not persist after restart.”
- Your runtime likely does not support Dynamic Properties. Logs will be session-only.
“Players are being kicked unexpectedly.”
- Kicks are disabled by default. If enabled:
- Review
allowKick, thresholds, cooldown, and kick-loop settings. - Use a bypass tag for trusted accounts (configured in Punishments).
- Review
Credits / License / Support
- Author / Maintainer: Frazer
- Special Thanks: Eagles
- License: Public Domain
- Support: https://discord.gg/realmhub

