aliases {
  dye-item-lore = "&bItem type and damage: &eminecraft:dye"
  dye-item {
    Item {
      Count = 1
      ItemType = "minecraft:dye"
    }
  }
  wheat-item {
    Item {
      Count = 1
      ItemType = "minecraft:wheat"
      UnsafeDamage = 0
      DisplayName = "&lWheat seller and consumer"
      ItemLore = [
        "&e9 wheats => $8"
        "&e$10 => 9 wheats"
        "&eYou can right click to buy some wheats"
        "&eand left click to sell some held by your mouse"
        "&eUse shift to sell or buy more wheats at one time"
        "&euntil an upper limit at 9 full stacks (576 items)"
      ]
    }
    PrimaryAction {
      Command = "cost-item: 9; cost: -8"
      HandheldItem {
        ItemType = "minecraft:wheat"
        Count = 9
        UnsafeDamage = 0
      }
      KeepInventoryOpen = true
    }
    PrimaryShiftAction {
      Command = "cost-item: 9; cost: -8"
      HandheldItem {
        ItemType = "minecraft:wheat"
        Count = 9
        UnsafeDamage = 0
        SearchInventory = true
        RepetitionUpperLimit = 63
      }
      KeepInventoryOpen = true
    }
  }
  compass-item {
    Item {
      Count = 1
      ItemType = "minecraft:compass"
      UnsafeDamage = 0
      DisplayName = "&lAnother way to open the GUI"
      ItemLore = [
        "&eYou can open the GUI in the game"
        "&ewhen you &lright click&r &eby the &lcompass"
        "&eWhat happened when you left click it?"
      ]
    }
    Requirements = "player.hasPermission('virtualchest.open.self.example2')"
    PrimaryAction {
      Command = "tell: You found the magic power of the compass!"
    }
    SecondaryAction = ${?PrimaryAction}
  }
  clock-item {
    Item {
      Count = 1
      ItemType = "minecraft:clock"
      UnsafeDamage = 0
      DisplayName = "&lAnother way to open the GUI"
      ItemLore = [
        "&eYou can open the GUI in the game"
        "&ewhen you &lright click&r &eby the &lcompass"
        "&eWhat happened when you left click it?"
        "&e&l================================"
        "&eIn fact, &lnothing will happen"
        "&ebecause you do not have the permission for"
        "&eopening that GUI (&cvirtualchest.open.self.example2&e)"
      ]
    }
    PrimaryAction {
      Command = "tell: You didn't find anything."
    }
    SecondaryAction = ${?PrimaryAction}
  }
}
virtualchest {
  TextTitle = "&2&lExample 1"
  Rows = 2
  UpdateIntervalTick = 20
  AcceptableActionIntervalTick = 20
  Slot0 = ${aliases.dye-item} {
    Item {
      UnsafeDamage = 1
      DisplayName = "&c&lI'm red"
      ItemLore = [
        ${aliases.dye-item-lore} "1"
      ]
    }
  }
  Slot1 = ${aliases.dye-item} {
    Item {
      UnsafeDamage = 2
      DisplayName = "&a&lI'm green"
      ItemLore = [
        ${aliases.dye-item-lore} "2"
      ]
    }
  }
  Slot2 = ${aliases.dye-item} {
    Item {
      UnsafeDamage = 4
      DisplayName = "&a&lI'm blue"
      ItemLore = [
        ${aliases.dye-item-lore} "4"
      ]
    }
  }
  Slot4 {
    Item {
      ItemType = "minecraft:skull"
      Count = 1
      UnsafeDamage = 3
      RepresentedPlayer = {
        UUID = "%player_uuid%"
      }
      DisplayName = "&lHey! It's yourself"
      ItemLore = [
        "&e&lRepresentedPlayer&r &ecan be used"
        "for player's item skull"
      ]
    }
  }
  Slot6 = ${aliases.dye-item} {
    Item {
      UnsafeDamage = 5
      DisplayName = "&lTell you some life experience"
      ItemLore = [
        "&e&lToo young!"
      ]
    }
    PrimaryAction {
      Command = """tellraw: {
                                 "bold": true,
                                 "text": "Too simple!",
                                 "hoverEvent": {"action": "show_text", "value": {"text": "Excited!"}}
                             };
                    delay: 20;
                    tell: +1s;
                    title: &l-1s;
                    delay: 20;
                    tell: +2s;
                    title: &l-2s;
                    delay: 20;
                    tell: +3s;
                    title: &l-3s;
                    delay: 20;
                    tellraw: {
                                 "bold": true,
                                 "text": "Sometimes naive!",
                                 "hoverEvent": {"action": "show_text", "value": {"text": "Excited!"}}
                             };
                    title:"""
      KeepInventoryOpen = false
    }
    SecondaryAction = ${?PrimaryAction}
  }
  Slot7 = ${aliases.dye-item} {
    Item {
      UnsafeDamage = 0
      DisplayName = "&lTry left/right click"
      ItemLore = [
        "&e&lDifferent title will be generated"
        "&e&lThen try to click with shift key pressed, and what will happen?"
      ]
    }
    PrimaryAction = {
      Command = """bigtitle: Primary;
                   subtitle: You have used the primary mouse button.;
                   broadcast: &a[Server]&r A player has used the primary mouse button."""
      KeepInventoryOpen = false
    }
    SecondaryAction = {
      Command = """bigtitle: Secondary;
                   subtitle: You have used the secondary mouse button.;
                   broadcast: &a[Server]&r A player has used the secondary mouse button."""
      KeepInventoryOpen = false
    }
    PrimaryShiftAction = {
      Command = """bigtitle: PrimaryShift;
                   subtitle: You have used the primary mouse button with shift key.;
                   broadcast: &a[Server]&r A player has used the primary mouse button with shift key."""
      KeepInventoryOpen = false
    }
    SecondaryShiftAction = {
      Command = """bigtitle: SecondaryShift;
                   subtitle: You have used the secondary mouse button with shift key.;
                   broadcast: &a[Server]&r A player has used the secondary mouse button with shift key."""
      KeepInventoryOpen = false
    }
  }
  Slot8 = [
    ${aliases.compass-item}
    ${aliases.clock-item}
  ]
  Slot9 {
    Item {
      Count = 63
      ItemType = "minecraft:gold_block"
      UnsafeDamage = 0
      DisplayName = "&7&lI almost fill the slot"
      ItemLore = [
        "&bItem type and damage: &eminecraft:gold_block 0"
        "&dCount: &e63"
        "&eAll of the item type, the damage, and the count"
        "&eshould be specified"
      ]
    }
  }
  Slot10 {
    Item {
      Count = 1
      ItemType = "minecraft:iron_block"
      UnsafeDamage = 0
      DisplayName = "&f&lI'm a white enchanter"
      ItemEnchantments = [
        "minecraft:protection:4"
        "minecraft:fire_protection:4"
        "minecraft:feather_falling:4"
        "minecraft:blast_protection:4"
        "minecraft:projectile_protection:4"
        "minecraft:respiration"
        "minecraft:aqua_affinity"
      ]
    }
  }
  Slot11 {
    Item {
      Count = 1
      ItemType = "minecraft:coal_block"
      UnsafeDamage = 0
      DisplayName = "&8&lI'm a black enchanter"
      ItemLore = [
        "&ewith hidden enchantments"
      ]
      ItemEnchantments = [
        "minecraft:infinity"
      ]
      HideEnchantments = true
    }
  }
  Slot13 = [
    ${aliases.wheat-item} {
      Requirements = "%economy_balance% >= 640"
      SecondaryAction = {
        Command = """cost: 10;
                     console: give %player_name% minecraft:wheat 9"""
        KeepInventoryOpen = true
      }
      SecondaryShiftAction = {
        Command = """cost: 640;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64;
                     console: give %player_name% minecraft:wheat 64"""
        KeepInventoryOpen = true
      }
    }
    ${aliases.wheat-item} {
      Requirements = "%economy_balance% >= 10"
      SecondaryAction = {
        Command = """cost: 10;
                     console: give %player_name% minecraft:wheat 9"""
        KeepInventoryOpen = true
      }
    }
    ${aliases.wheat-item}
  ]
  Slot15 {
    Item {
      Count = 1
      ItemType = "minecraft:redstone_block"
      UnsafeDamage = 0
      DisplayName = "&4&lAttention!"
      ItemLore = [
        "&eI'll show you the help menu"
      ]
      ItemEnchantments = [
        "minecraft:infinity"
      ]
      HideEnchantments = true
    }
    PrimaryAction {
      Command = "help"
      KeepInventoryOpen = false
    }
    SecondaryAction {
      Command = "help"
      KeepInventoryOpen = false
    }
    IgnoredPermissions = [
      "sponge.command.help"
    ]
  }
  Slot16 {
    Item {
      Count = 1
      ItemType = "minecraft:quartz_block"
      UnsafeDamage = 0
      DisplayName = "&lHello! %player_name%"
      ItemLore = [
        "&eYou are now at &l%player_world%"
        "&eThe server now has &l%server_online%&r &eplayer(s), and the capacity is &l%server_max_players%"
        "&eIt is &l%time%&r &enow"
      ]
      ItemEnchantments = [
        "minecraft:infinity"
      ]
      HideEnchantments = true
    }
  }
  Slot17 = [{
    Item {
      Count = 1
      ItemType = "minecraft:diamond_block"
      UnsafeDamage = 0
      DisplayName = "&lGoodbye! %player_name%"
      ItemLore = [
        "&eYou will open another chest GUI"
        "&eIt will take you 7 if you click this item"
        "&eYou have %economy_bal_format% now"
      ]
    }
    Requirements = "%economy_balance% >= 7"
    PrimaryAction {
      Command = "cost: 7; console: virtualchest open example2 %player_name%"
      KeepInventoryOpen = true
    }
    SecondaryAction {
      Command = "cost: 7; console: virtualchest open example2 %player_name%"
      KeepInventoryOpen = true
    }
  }, {
    Item {
      Count = 1
      ItemType = "minecraft:barrier"
      UnsafeDamage = 0
      DisplayName = "&lOops! %player_name%"
      ItemLore = [
        "&eYou want to open another chest GUI"
        "&eBut you do not have enough money (7)"
        "&eYou have %economy_bal_format% now"
      ]
    }
  }]
  TriggerItem {
    ItemType = "minecraft:compass"
    EnablePrimaryAction = false
    EnableSecondaryAction = true
  }
}
