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)