nalla_sher

Create a Minecraft Skript code for a Duplication Wand.

Specifications:

Command: /dupwand gives a stick named "&d&lDuplication Wand" with lore "&7Right-click a block or item to duplicate it". Permission required: op or dupwand.admin.

Block & Shulker Duplication: When right-clicking any placed block (including filled Shulker Boxes, Chests, or barrels), drop an exact copy of the block with all NBT data, lore, items, and container contents preserved.

Item Duplication: When right-clicking air with the wand, duplicate the item in the player's offhand with full NBT, lore, and container contents intact.

Effects & Safety: Play an enderman teleport sound and purple portal particles at the block/player location upon successful duplication. Include a 2-second cooldown to prevent server lag.

Provide only clean, error-free .sk code compatible with modern Skript versions.

Kodari AI
KodariAug 23 at 10:28 am 1
DuplicationWand
A Skript-based duplication wand system. Grants players a custom stick via /dupwand command with permission checks. Right-clicking placed blocks or shulker boxes duplicates them with full NBT data, container contents, and lore preserved. Right-clicking air duplicates the offhand item. Features enderman teleport sound effects, purple portal particles, and a 2-second cooldown to prevent server lag. Includes permission node dupwand.admin for command access.
Kodari can make mistakes. Review important code before using.
Files
duplication-wand.sk
Code
1 57
duplication-wand.sk
# Requires Skript and SkBee

options:
    wand-name: &d&lDuplication Wand
    wand-lore: &7Right-click a block or item to duplicate it

function isDuplicationWand(i: item) :: boolean:
    if {_i} is a stick:
        if name of {_i} is "{@wand-name}":
            return true
    return false

function duplicateItem(p: player, i: item, l: location):
    if {dupwand.cooldown::%uuid of {_p}%} is set:
        if difference between now and {dupwand.cooldown::%uuid of {_p}%} < 2 seconds:
            stop

    set {dupwand.cooldown::%uuid of {_p}%} to now
    drop {_i} at {_l}
    play sound "entity.enderman.teleport" at {_l}
    play 20 of portal at {_l}

command /dupwand:
    executable by: players
    trigger:
        if player is not op:
            if player doesn't have permission "dupwand.admin":
                send "&cYou do not have permission to use this command."
                stop

        set {_wand} to stick named "{@wand-name}"
        set lore of {_wand} to "{@wand-lore}"
        give {_wand} to player
        send "&aYou received the &d&lDuplication Wand&a."

on right click on block:
    if isDuplicationWand(player's tool) is false:
        stop

    cancel event

    set {_duplicate} to 1 of item type of event-block
    set {_block-nbt} to nbt compound of event-block
    set nbt of {_duplicate} to {_block-nbt}

    duplicateItem(player, {_duplicate}, location of event-block)

on right click on air:
    if isDuplicationWand(player's tool) is false:
        stop

    if player's off hand tool is air:
        stop

    cancel event
    set {_duplicate} to player's off hand tool
    duplicateItem(player, {_duplicate}, location of player)