Skript

Skript

743k Downloads

How to give the player a Shulker Box with specific content

Top4nk-777 opened this issue · 1 comments

commented

Skript/Server Version

[08:10:54 INFO]: [Skript] Skript的alias可以在这里找到:https://github.com/SkriptLang/skript-aliases
[08:10:54 INFO]: [Skript] Skript的文档可以在这里找到:https://docs.skriptlang.org/
[08:10:54 INFO]: [Skript] Skript的教程可以在这里找到:https://docs.skriptlang.org/tutorials
[08:10:54 INFO]: [Skript] 服务器版本:1.21-127-4e6a2a1 (MC: 1.21)
[08:10:54 INFO]: [Skript] Skript版本:2.9.1 (skriptlang-github)
[08:10:54 INFO]: [Skript] 已安装的Skript插件:[08:10:54 INFO]: [Skript]  - SkBee v3.6.1 (https://github.com/ShaneBeee/SkBee)
[08:10:54 INFO]: [Skript] 已安装的依赖:None

Bug Description

This my currently use:
execute console command "give %player% minecraft:shulker_box{display:{Name:'{"text":"AQ-Team | Obsidian.tar.gz"}'},BlockEntityTag:{Items:[{Slot:0b,id:"minecraft:ender_chest",Count:64b},{Slot:1b,id:"minecraft:ender_chest",Count:64b},{Slot:2b,id:"minecraft:ender_chest",Count:64b},{Slot:3b,id:"minecraft:ender_chest",Count:64b},{Slot:4b,id:"minecraft:ender_chest",Count:64b},{Slot:5b,id:"minecraft:ender_chest",Count:64b},{Slot:6b,id:"minecraft:ender_chest",Count:64b},{Slot:7b,id:"minecraft:ender_chest",Count:64b},{Slot:8b,id:"minecraft:ender_chest",Count:64b},{Slot:9b,id:"minecraft:ender_chest",Count:64b},{Slot:10b,id:"minecraft:ender_chest",Count:64b},{Slot:11b,id:"minecraft:ender_chest",Count:64b},{Slot:12b,id:"minecraft:ender_chest",Count:64b},{Slot:13b,id:"minecraft:ender_chest",Count:64b},{Slot:14b,id:"minecraft:ender_chest",Count:64b},{Slot:15b,id:"minecraft:ender_chest",Count:64b},{Slot:16b,id:"minecraft:ender_chest",Count:64b},{Slot:17b,id:"minecraft:ender_chest",Count:64b},{Slot:18b,id:"minecraft:ender_chest",Count:64b},{Slot:19b,id:"minecraft:ender_chest",Count:64b},{Slot:20b,id:"minecraft:ender_chest",Count:64b},{Slot:21b,id:"minecraft:ender_chest",Count:64b},{Slot:22b,id:"minecraft:ender_chest",Count:64b},{Slot:23b,id:"minecraft:ender_chest",Count:64b},{Slot:24b,id:"minecraft:ender_chest",Count:64b},{Slot:25b,id:"minecraft:ender_chest",Count:64b},{Slot:26b,id:"minecraft:ender_chest",Count:64b}]}}"

But it occur error:
Can't understand this condition/effect: execute console command "give %player% minecraft:shulker_box{display:{Name:'{"text":"AQ-Team | Obsidian.tar.gz"}'},BlockEntityTag:{Items:[{Slot:0b,id:"minecraft:ender_chest",Count:64b},{Slot:1b,id:"minecraft:ender_chest",Count:64b},{Slot:2b,id:"minecraft:ender_chest",Count:64b},{Slot:3b,id:"minecraft:ender_chest",Count:64b},{Slot:4b,id:"minecraft:ender_chest",Count:64b},{Slot:5b,id:"minecraft:ender_chest",Count:64b},{Slot:6b,id:"minecraft:ender_chest",Count:64b},{Slot:7b,id:"minecraft:ender_chest",Count:64b},{Slot:8b,id:"minecraft:ender_chest",Count:64b},{Slot:9b,id:"minecraft:ender_chest",Count:64b},{Slot:10b,id:"minecraft:ender_chest",Count:64b},{Slot:11b,id:"minecraft:ender_chest",Count:64b},{Slot:12b,id:"minecraft:ender_chest",Count:64b},{Slot:13b,id:"minecraft:ender_chest",Count:64b},{Slot:14b,id:"minecraft:ender_chest",Count:64b},{Slot:15b,id:"minecraft:ender_chest",Count:64b},{Slot:16b,id:"minecraft:ender_chest",Count:64b},{Slot:17b,id:"minecraft:ender_chest",Count:64b},{Slot:18b,id:"minecraft:ender_chest",Count:64b},{Slot:19b,id:"minecraft:ender_chest",Count:64b},{Slot:20b,id:"minecraft:ender_chest",Count:64b},{Slot:21b,id:"minecraft:ender_chest",Count:64b},{Slot:22b,id:"minecraft:ender_chest",Count:64b},{Slot:23b,id:"minecraft:ender_chest",Count:64b},{Slot:24b,id:"minecraft:ender_chest",Count:64b},{Slot:25b,id:"minecraft:ender_chest",Count:64b},{Slot:26b,id:"minecraft:ender_chest",Count:64b}]}}"

Expected Behavior

give player a Shulker Box containing items

Steps to Reproduce

this script
command /store:
trigger:
set {_store_gui} to chest inventory with 3 rows named "&5官方商店 | 您的贊助額度還剩: &e$%{balance.%player%}%"

    # Add items to the store GUI
    set slot 0 of {_store_gui} to diamond named "&bBuy Diamond" with lore "&7Price: $100"
    set slot 1 of {_store_gui} to iron sword named "&bBuy Iron Sword" with lore "&7Price: $150"
    set slot 2 of {_store_gui} to shulker box named "&bAQ-Team | Obsidian.tar.gz" with lore "&7Price: $1000"

    # Open the GUI for the player
    open {_store_gui} to player

on inventory click:
if event-inventory's name contains "&5官方商店": # 确保是在商店GUI内进行的点击
cancel event # 取消所有点击事件,防止物品被拖出
if clicked slot is 0: # 点击购买钻石
if {balance.%player%} >= 100:
remove 100 from {balance.%player%}
give diamond to player
send "&a你已成功购买 &b钻石 &a,花费 &6$100!" to player
else:
send "&c你的余额不足以购买钻石!" to player

    if clicked slot is 1:  # 点击购买铁剑            
        if {balance.%player%} >= 150:
            remove 150 from {balance.%player%}
            give iron sword to player
            send "&a你已成功购买 &b铁剑 &a,花费 &6$150!" to player
        else:
            send "&c你的余额不足以购买铁剑!" to player

    if clicked slot is 2:  # box gui            
        # Open the new GUI
        set {_store_gui_2} to chest inventory with 4 rows named "&5Special Shulker Box Contents"
        
        # Display shulker box contents in the first 3 rows
        set slot 27 of {_store_gui_2} to green stained glass pane named "&aBuy" with lore "&7Click to purchase this item"
        set slot 30 of {_store_gui_2} to red stained glass pane named "&cReturn" with lore "&7Click to return to the previous menu"
        
        open {_store_gui_2} to player

on inventory click:
if event-inventory's name contains "&5Special Shulker Box Contents":
cancel event
if clicked slot is 27: # 购买按钮 if {balance.%player%} >= 1000:
remove 1000 from {balance.%player%}

            # 使用 give 命令给予玩家物品                execute console command "give %player% minecraft:shulker_box{display:{Name:'{\"text\":\"AQ-Team | Obsidian.tar.gz\"}'},BlockEntityTag:{Items:[{Slot:0b,id:\"minecraft:ender_chest\",Count:64b},{Slot:1b,id:\"minecraft:ender_chest\",Count:64b},{Slot:2b,id:\"minecraft:ender_chest\",Count:64b},{Slot:3b,id:\"minecraft:ender_chest\",Count:64b},{Slot:4b,id:\"minecraft:ender_chest\",Count:64b},{Slot:5b,id:\"minecraft:ender_chest\",Count:64b},{Slot:6b,id:\"minecraft:ender_chest\",Count:64b},{Slot:7b,id:\"minecraft:ender_chest\",Count:64b},{Slot:8b,id:\"minecraft:ender_chest\",Count:64b},{Slot:9b,id:\"minecraft:ender_chest\",Count:64b},{Slot:10b,id:\"minecraft:ender_chest\",Count:64b},{Slot:11b,id:\"minecraft:ender_chest\",Count:64b},{Slot:12b,id:\"minecraft:ender_chest\",Count:64b},{Slot:13b,id:\"minecraft:ender_chest\",Count:64b},{Slot:14b,id:\"minecraft:ender_chest\",Count:64b},{Slot:15b,id:\"minecraft:ender_chest\",Count:64b},{Slot:16b,id:\"minecraft:ender_chest\",Count:64b},{Slot:17b,id:\"minecraft:ender_chest\",Count:64b},{Slot:18b,id:\"minecraft:ender_chest\",Count:64b},{Slot:19b,id:\"minecraft:ender_chest\",Count:64b},{Slot:20b,id:\"minecraft:ender_chest\",Count:64b},{Slot:21b,id:\"minecraft:ender_chest\",Count:64b},{Slot:22b,id:\"minecraft:ender_chest\",Count:64b},{Slot:23b,id:\"minecraft:ender_chest\",Count:64b},{Slot:24b,id:\"minecraft:ender_chest\",Count:64b},{Slot:25b,id:\"minecraft:ender_chest\",Count:64b},{Slot:26b,id:\"minecraft:ender_chest\",Count:64b}]}}"

            send "&a你已成功购买物品,花费 &6$1000!" to player
        else:
            send "&c你的余额不足以购买这个物品!" to player

Errors or Screenshots

No response

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.
commented

Your problem is not doubling the " marks inside the string. However, you shouldn't be using commands for this anyway. You can simply:

set {_box} to a shulker box
set slot 4 of inventory of {_box} to stone slab
give player {_box}