Skip to content

How to Set Up Crates

zhenghanlee edited this page Jul 5, 2021 · 19 revisions

Introduction

From Beta 2.4 onwards, CustomShop will no longer be handling key & crates. It has always been decided this way. Server owners should use proper crate plugins such as Crate Reloaded (Mystery Crate) or CratesPlus (examples given below). However, CustomShop will still be keeping track of players' shop designs unlock statuses. For unlock statuses to take effect, set unlock-all in config.yml to false.

For compatibility with ItemsAdder, CratePlus is recommended. Refer here for steps to set up crates with ItemsAdder.

Crate Rewards

Conditions

CustomShop listens to block placement events for unlocking shop designs. The block must:

  1. Be a player head of any design
  2. Have a custom model data for a non-default model that is listed in CustomShop's config.yml (A default model is a model that is rendered to represent "locked" status of other shop designs)
  3. Have a display name that is the same as the display name in config.yml that corresponds to the custom model data.

Set your rewards adhering to the above. Other than that, do whatever you want.

Upon placement of the player head, the player will be prompted to place the head again as a confirmation. If player has already the shop design unlocked, the player head will not be consumed.

CustomShop Command

The plugin provides a way to give player rewards through a simpler console command, /cs givehead <player> <model_data> [url]. url is an optional argument if you want another custom player head design. The url can be found at the bottom of any design's page (starting with http://textures.minecraft.net/texture/...).

Crate Reloaded Example

Crate Reloaded Example

This is an example of a crate configuration that can be used in Crate Reloaded's crate.yml. As far as I know, only the premium version supports custom model data in terms of the items shown in the crate, which doesn't affect the rewards given if you use CustomShop's command. Refer below for free alternative, CratesPlus.

# -------------------------------------------------------------------------------------------------------------------
# An example of CustomShop Crate configuration
CustomShop:
  type: KEYCRATE # Set this crate to a block, and players may right click the block to use "keys"
  item: "TRIPWIRE_HOOK 1 name:&c[&6CustomShop_Key&c] lore:&8Right_click_on_crate_to_receive_a_shop! glow:true"
  animation: "ROULETTE"
  end-animation: "RANDOM"
  display-name: "&5&lCustomShop Crate"
  holographic:
    - "{crate-name}"
    - "{lore:1}"
  confirmation:
    enabled: false
    accept-button: "GREEN_STAINED_GLASS_PANE 1 name:&aYes lore:&fClick_here_to_open_{crate}!"
    decline-button: "RED_STAINED_GLASS_PANE 1 name:&4No"
  preview:
    enabled: true
    rows: 2
  buy:
    enabled: false
    cost: 0
  message:
    open: "{p}&eYou have opened the CustomShop Crate and obtained {item}&e!"
    broadcast: "{p}&e{player} opened the CustomShop Crate and obtained {item}&e!"
  effect:
    1:
      class: DiscoBall
      category: PERSISTENT
      relativeOffset: "0,2,0"
    2:
      class: Sound
      category: ANIMATION
      sound: BLOCK_LEVER_CLICK
    3:
      class: Sound
      sound: ENTITY_PLAYER_LEVELUP
      category: END
  reward:
    minimum-rewards: 1
    maximum-rewards: 1
    rewards:
      - "unique:(), chance:(1), cmd:(cs givehead {player} 101), display:(paper{CustomModelData:101} 1 name:&6Wooden_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 102), display:(paper{CustomModelData:102} 1 name:&6Stone_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 103), display:(paper{CustomModelData:103} 1 name:&6Nether_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 104), display:(paper{CustomModelData:104} 1 name:&6Sand_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 105), display:(paper{CustomModelData:105} 1 name:&6Prismarine_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 106), display:(paper{CustomModelData:106} 1 name:&6Ice_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 107), display:(paper{CustomModelData:107} 1 name:&6Blackstone_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 108), display:(paper{CustomModelData:108} 1 name:&6Copper_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 109), display:(paper{CustomModelData:109} 1 name:&6Amethyst_Vending_Machine)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 201), display:(paper{CustomModelData:201} 1 name:&6Wooden_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 202), display:(paper{CustomModelData:202} 1 name:&6Stone_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 203), display:(paper{CustomModelData:203} 1 name:&6Nether_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 204), display:(paper{CustomModelData:204} 1 name:&6Sand_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 205), display:(paper{CustomModelData:205} 1 name:&6Prismarine_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 206), display:(paper{CustomModelData:206} 1 name:&6Ice_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 207), display:(paper{CustomModelData:207} 1 name:&6Blackstone_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 208), display:(paper{CustomModelData:208} 1 name:&6Copper_Newt's_Briefcase)"
      - "unique:(), chance:(1), cmd:(cs givehead {player} 209), display:(paper{CustomModelData:209} 1 name:&6Amethyst_Newt's_Briefcase)"

CratesPlus example

CratesPlus Example

This is an example of a crate configuration that can be used in CratesPlus's config.yml.

Crates:
  CustomShop:
    Type: KeyCrate
    Knockback: 0
    Broadcast: false
    Firework: true
    Color: DARK_GREEN
    Block: CHEST
    Preview: true
    Cooldown: 1
    Hide Percentages: true
    Permission: cratesplus.crate.cratename
    Hologram Text:
      - Hologram Line 1
      - Hologram Line 2
    Key:
      Item: TRIPWIRE_HOOK
      Name: "%type% Crate Key"
      Enchanted: true
    Winnings:
      "1":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 101
        Name: "&6Wooden Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 101
        Amount: 1
      "2":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 102
        Name: "&6Stone Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 102
        Amount: 1
      "3":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 103
        Name: "&6Nether Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 103
        Amount: 1
      "4":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 104
        Name: "&6Sand Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 104
        Amount: 1
      "5":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 105
        Name: "&6Prismarine Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 105
        Amount: 1
      "6":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 106
        Name: "&6Ice Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 106
        Amount: 1
      "7":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 107
        Name: "&6Blackstone Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 107
        Amount: 1
      "8":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 108
        Name: "&6Copper Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 108
        Amount: 1
      "9":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 109
        Name: "&6Amethyst Vending Machine"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 109
        Amount: 1
      "10":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 201
        Name: "&6Wooden Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 201
        Amount: 1
      "11":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 202
        Name: "&6Stone Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 202
        Amount: 1
      "12":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 203
        Name: "&6Nether Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 203
        Amount: 1
      "13":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 204
        Name: "&6Sand Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 204
        Amount: 1
      "14":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 205
        Name: "&6Prismarine Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 205
        Amount: 1
      "15":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 206
        Name: "&6Ice Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 206
        Amount: 1
      "16":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 207
        Name: "&6Blackstone Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 207
        Amount: 1
      "17":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 208
        Name: "&6Copper Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 208
        Amount: 1
      "18":
        Type: COMMAND
        Item Type: PAPER
        Percentage: 1
        Commands:
          - cs givehead %name% 209
        Name: "&6Amethyst Newt's Briefcase"
        Metadata:
          ==: ItemMeta
          meta-type: UNSPECIFIC
          custom-model-data: 209
        Amount: 1

ItemsAdder

As of what I have tested, CratePlus supports ItemsAdder's items. You just have to:

  1. Run /crate create CustomShop or any other name you want to name the crate
  2. Run /ia to open ItemsAdder's menu to retrieve non-default vending machine and newt's briefcase models under All section
  3. Run /crate settings to edit our CustomShop crate by adding items obtained from the previous step into the winnings
  4. Open up CratePlus's config.yml and change all winnings type to COMMAND
  5. Replicate the commands in the previous section into the configuration of the winnings

Note: When setting the commands to execute for the winnings, disregard the custom model data given by ItemsAdder. Instead, we still execute - cs givehead %name% 101 for Wooden Vending Machine, - cs givehead %name% 102 for Stone Vending Machine etc.

Clone this wiki locally