function sendUsage(p: player): send "&7------------------------------------" to {_p} send "&7 &a&lVoucher Commands&7 " to {_p} send "&a /voucher edit [voucher name]" to {_p} send "&a /voucher create/new [voucher name]" to {_p} send "&a /voucher remove/delete [voucher name]" to {_p} send "&a /voucher give [voucher name] [player]" to {_p} send "&a /voucher command add/remove/list [voucher name] [command]" to {_p} send "&a &b&lMade By: &cDarklordX89" to {_p} send "&7------------------------------------" to {_p} command /voucher [] [] [] []: trigger: if arg-1 is "help": sendUsage(player) if arg-1 is "edit": if arg-2 is set: set {arg2} to arg-2 replace all "_" with " " in {arg2} if {voucher.%{arg2}%} is not set: send "&cVoucher doesn't exist!" to player stop editVoucher(player, {arg2}, 1) else: sendUsage(player) if arg-1 is "create" or "new": if arg-2 is set: set {arg2} to arg-2 replace all "_" with " " in {arg2} if player's held item is air: send "&cCannot create voucher using air!" to player stop set {voucher.%{arg2}%} to player's tool add "%{arg2}%" to {voucherlist::*} send "&dCreated Voucher &c%{arg2}%&d!" to player else: sendUsage(player) if arg-1 is "remove" or "delete": if arg-2 is set: set {arg2} to arg-2 replace all "_" with " " in {arg2} if {voucher.%{arg2}%} is not set: send "&cVoucher doesn't exist!" to player else: delete {voucher.%{arg2}%} remove "%{arg2}%" from {voucherlist::*} delete {voucher.commands.%{arg2}%::*} send "&cDeleted Voucher &d%{arg2}%&c!" else: sendUsage(player) if arg-1 is "give": if arg-2 is set: set {arg2} to arg-2 replace all "_" with " " in {arg2} if {voucher.%{arg2}%} is set: if arg-3 is set: set {player} to arg-3 parsed as player give {player} {voucher.%{arg2}%} send "&dGave &c%arg-3% &dvoucher &c%{arg2}%&d!" to player send "&cYou&d were given the voucher &c%{arg2}%&d!" to {player} else: give player {voucher.%{arg2}%} send "&cYou&d received the voucher &c%{arg2}%&d!" to player else: sendUsage(player) if arg-1 is "command": set {vouchername} to arg-3 replace all "_" with " " in {vouchername} if arg-2 is "add": if arg-3 is set: if {voucher.%{vouchername}%} is not set: send "&cVoucher Doesn't Exist!" stop if arg-4 is set: set {command} to arg-4 replace all "_" with " " in {command} if {voucher.commands.%{vouchername}%::*} contains {command}: send "&cCommand already found in voucher &6%arg-3%" to player else: add "%{command}%" to {voucher.commands.%{vouchername}%::*} send "&aAdded command &6%{command}%&a to voucher &6%arg-3%&a!" else: sendUsage(player) else: sendUsage(player) if arg-2 is "remove": if arg-3 is set: if {voucher.%{vouchername}%} is not set: send "&cVoucher Doesn't Exist!" stop if arg-4 is set: set {command} to arg-4 replace all "_" with " " in {command} if {voucher.commands.%{vouchername}%::*} contains {command}: remove "%{command}%" from {voucher.commands.%{vouchername}%::*} send "&cRemoved command &6%{command}%&c from voucher &6%arg-3%&c!" else: send "&cCommand not found in voucher &6%arg-3%" to player else: sendUsage(player) else: sendUsage(player) if arg-2 is "list": if arg-3 is set: if {voucher.%{vouchername}%} is not set: send "&cVoucher Doesn't Exist!" stop if {voucher.commands.%{vouchername}%::*} is not set: send "&cCommands: &aNone" else: send "&cCommands: &a%{voucher.commands.%{vouchername}%::*}%" else: sendUsage(player) if arg-2 is not "add", "remove" or "list": sendUsage(player) if arg-1 is not "command", "create", "new", "delete", "remove", "give", "help" or "edit": sendUsage(player) function editVoucher(p: player, voucher: text, page: number): if {pageisset::*} contains "%{_page}%": send "a" to {_a.%{_g}%::%{_ree}%} if {vouchers::*} does not contain "%{_voucher}%": add "%{_voucher}%" to {vouchers::*} if {pageisset.%{_voucher}%::*} does not contain "%{_page}%": add "%{_page}%" to {pageisset.%{_voucher}%::*} open chest inventory with 4 rows named "&3&lItems In Voucher: %{_voucher}%" to {_p} set {_i} to 0 loop {voucheritems.%{_page}%.%{_voucher}%::*}: set slot {_i} of {_p}'s current inventory to loop-value add 1 to {_i} if {voucher.commands.%{_voucher}%::*} is not set: set slot 35 of {_p}'s current inventory to paper named "&a&lCommands" with lore "&aNo Command Set" else: set slot 35 of {_p}'s current inventory to paper named "&a&lCommands" loop {voucher.commands.%{_voucher}%::*}: add "&c%loop-value%" to lore of slot 35 of {_p}'s current inventory while name of current inventory of {_p} contains "&3&lItems In Voucher: ": delete {_items.%{_page}%.%{_voucher}%::*} set {_items.%{_page}%.%{_voucher}%::*} to items in current inventory of {_p} remove slot 35 of {_p}'s current inventory from {_items.%{_page}%.%{_voucher}%::*} wait 1 tick delete {voucheritems.%{_page}%.%{_voucher}%::*} set {voucheritems.%{_page}%.%{_voucher}%::*} to {_items.%{_page}%.%{_voucher}%::*} on inventory click: if name of current inventory of player contains "&3&lItems In Voucher: ": if clicked slot is 35: cancel event on right click: loop {voucherlist::*}: if player's tool is {voucher.%loop-value%}: player has space for {voucheritems.1.%loop-value%::*}: if {voucher.commands.%loop-value%::*} is set: loop {voucher.commands.%loop-value%::*}: set {commandrun} to loop-value-2 replace all "{player}" with "%player%" in {commandrun} make player run command "%{commandrun}%" as op give player {voucheritems.1.%loop-value%::*} remove 1 of player's held item from player send "&dRedeemed Voucher &c%loop-value%&d!" else: if {voucheritems.1.%loop-value%::*} is not set: if {voucher.commands.%loop-value%::*} is set: loop {voucher.commands.%loop-value%::*}: set {commandrun} to loop-value-2 replace all "{player}" with "%player%" in {commandrun} make player run command "%{commandrun}%" as op remove 1 of player's held item from player stop send "&cYou need more space in your inventory!" to player on tab complete of "/voucher": set tab completions for position 1 to "create", "edit", "remove", "command", "help" and "give" set {vouchersfortab::*} to {voucherlist::*} replace all " " with "_" in {vouchersfortab::*} if tab arg-1 is "command": set tab completions for position 2 to "add", "remove" and "list" set tab completions for position 3 to {vouchersfortab::*} if tab arg-1 is "give": set tab completions for position 2 to {vouchersfortab::*} set tab completions for position 3 to all players if tab arg-1 is "create", "edit" or "remove": set tab completions for position 2 to {vouchersfortab::*}