GreenCrate Plugin 1.6.4

Updated: May 22, 2015 | 776 views |


GreenCrate is a simple plugin that adds prize crate items to your server. ?Crates? are items that open when right clicked, awarding the player specified items as defined in the config.yml file for that crate. Crates can be configured with custom item IDs, data values, and custom display names, among many other options. They can also open customized chest GUI screens for the user to take items out of, as well as drop from mobs as a reward. Items in the crates can be configured with data values, amounts, enchantments, display names, and lore.

Commands and Permissions

This plugin uses the /crate command to distribute and manipulate crates manually. All command functionalitites from previous versions have been combined into this single command.

  • /crate reload ? Reloads the main config.yml file. (Permission: greencrate.crate.reload) ?
  • /crate list ? Lists all crates available to you. (Permission: greencrate.crate.list)
  • /crate spawn <name> ? Spawn the item for the specified crate into your inventory. (Permission: greencrate.crate.spawn)
  • /crate give <player> <name> ? Gives the crate item for the specified crate to the given player. (Permission: greencrate.crate.give) ?
  • /crate random ? Spawns the crate item for a random crate into your inventory. (Permission: greencrate.crate.random)
  • /crate giverandom <player> ? Gives the item for a random crate to the specified player. (Permission: greencrate.crate.giverandom) ?
  • /crate open <name> ? Opens the specified crate for you without the crate item. (Permission:
  • /crate openfor <name> <player> ? Opens the specified crate for the given player without the crate item. (Permission: greencrate.crate.openfor) ?
  • /crate openrandom ? Opens (gives you the items for, or opens the chest GUI for) a random crate in the config. (Permission: greencrate.crate.openrandom)
  • /crate openrandomfor <name> ? Opens a random crate for the specified player. (Permission: greencrate.crate.openrandomfor) ?

? Can be run from the server console.

If you have individual crate permissions enabled, you must give players greencrate.use.<cratename> for them to be allowed to open the crate.


The config.yml file for GreenCrate defines the properties and contents of all crates, as well as mob drops assignment and global permission settings. The default config file automatically generates if one does not exist already. The default configuration is as follows:

###  GreenCrate Default Configuration  ###
### ----  ----  ----  ----  ----  ---- ###
###     == VERSION 0.0.8 [Alpha] ==    ###
### ----  ----  ----  ----  ----  ---- ###
###      (Contains Example Crates)     ###

  require-crate-perms: false

    percent-mode: 'Individual'
      Example1: 100
    percent-mode: 'XOR'
        lower: 0
        upper: 50
        lower: 50
        upper: 100


    item-id: 35
    item-data: 6
    display-name: '&eShovel Crate #{rand}'
    item-lore: 'none'
    cancel-event: true
    confiscate: true
    notify-used: true
    notify-msg: 'You used <displayname>: <cratename>'
    cooldown-enabled: false
    cooldown-period: 0
    cooldown-message: 'null'
    bind-to-player: false
        ID: 256
        DATA: 5
          - 'DURABILITY-2'
        DISPLAYNAME: 'Blargshovell'
          - 'It digs.'
          - 'Yup.'
        ID: 35
        DATA: 15
        AMOUNT: 6
      enabled: true
      chest-rows: 1
      label: 'Crate'
      persistent-items: true

    item-id: 35
    item-data: 6
    display-name: '&ePickaxe Crate'
    item-lore: 'none'
    cancel-event: true
    confiscate: true
    notify-used: true
    notify-msg: 'You used <displayname>: <cratename>'
    cooldown-enabled: true
    cooldown-period: 10000
    cooldown-message: '&cYou are not yet allowed to use this crate again.'
    bind-to-player: true
        ID: 257
        DATA: 25
          - 'DURABILITY-1'
        DISPLAYNAME: 'Blargenpikk'
          - 'It mines.'
          - 'Yup.'
        ID: 35
        DATA: 7
        AMOUNT: 3
      enabled: false
      chest-rows: 0
      label: 'n/a'
      persistent-items: false

The configuration file is composed of three main sections: global, mobs, and crates.


There is currently only one global setting: ?require-crate-perms?. This enables the use of per-crate permissions. If enabled, you would then have to assign each player the greencrate-use.<cratename> permission for them to use each crate.


Crates can be set to drop from mobs on death. Each mob can be specified under the ?mobs? node, and has a ?percent-mode?, and a ?drops? node underneath it. Percent chance modes define how the plugin calculates the chances of a crate being dropped. There are two chance modes: Individual and XOR. Individual mode checks each chance against a random number, allowing for multiple crates to be dropped from a single mob. XOR mode drops only one crate, based upon checking the given range of chances against a single random number.

As can be seen in the default config, each mode has a different way of adding nodes under ?drops?. Individual mode only require the crate name and the drop chance. XOR mode requires each crate node to have a ?lower? and an ?upper? node under it. The combined uppers and lowers of each crate construct a scale to be compaired with a random number. For example, a config with a 30% chance of getting crates A, B, or C, and a 10% chance of nothing would look like this:

    lower: 0
    upper: 30
    lower: 30
    upper: 60
    lower: 60
    upper: 90


As shown, each crate must have the item-id, item-data, display-name, enable-crate-number, enable-lore-name, cancel-event, confiscate, notify-used, notify-msg, cooldown-enabled, cooldown-message, cooldown-period, and contents properties.

  • item-id defines the item type ID of the crate item.
  • item-data defines the data value (or durability) of the crate item.
  • display-name defines the item display name, if desired. (set to ?none? to disable)
  • item-lore defines what lore, if any, to add to the item. (set to ?none? to disable)
  • cancel-event whether or not the PlayerInteractEvent is cancelled. (cancels block placement, for example)
  • confiscate whether or not the crate item is removed from the player inventory after it is used.
  • notify-used whether or not to display a message in chat when the crate is used.
  • notify-msg the chat message for notify-used.
  • cooldown-enabled whether or not cooldown times are enabled for this crate.
  • cooldown-period the cooldown time (in milliseconds) after which a player may use the crate again.
  • cooldown-message the message to be displayed if the player?s cooldown period is not yet over.
  • bind-to-player whether or not crates should bind to players when given to them. Bound crates cannot be used by any other player.
  • contents defines the item contents of the crate.
  • gui contains settings pertaining to custom Chest UIs associated to the crate.

Nodes under ?contents? define each item or stack of items in the crate. Every property for each item is completely optional; if all properties are omitted, the item defaults to a poisonous potato. Item properties available are as follows:

  • ID defines the item ID.
  • DATA defines the item?s data value.
  • AMOUNT defines amount of the given item to be given.
  • ENCHANTMENTS gives a list of enchantments to be applied. This uses the Bukkit enchantment enumeration names (NOTE: You can use unsafe enchantment levels.)
  • DISPLAYNAME defines a custom display name.
  • LORE defines custom lore for the item.

GUI setting nodes can be used to create chest UI for your crate when it is opened. The items in the crate will fill up the UI automatically, in order of their definition in config.The nodes are as follows:

  • enabled enables or disables whether a chest opens showing the crate contents on usage of the crate.
  • chest-rows defines the number of rows in the chest.
  • label defines the title at the top of the chest. (For example, ?Crate? instead of ?Chest?)
  • persistent-items enables or disables unlimited items in crates. Stacks will re-appear as the player takes them out of the crate.

WARNING: Since this project is still in an early development stage, the format of the config.yml may change in between versions and may not always be cross-compatible. Be sure to update your config to the latest formatting when updating to a newer version.

Bug Fixes

This plugin is very early in development. If you find a bug, please submit a ticket. I need to know what version of CraftBukkit you are using and the contents of your config.yml file. If it is an Exception in the console, I also need the exact text of the Exception from the console. If it is a problem with the plugin itself, I will do my best to fix it.


The source code for this plugin is available on GitHub. I apologize if the code is outdated; I?m not really good with GitHub, and I might have trouble merging all of the up-to-date changes.

Feature Requests

If you have feature requests, please PM me, submit a ticket, or leave a comment. I can use all the good ideas I can get to make this plugin better. Some possible future additions are listed below. (This is not an exhaustive list.)

Planned Additions:

  • ?[GreenCrate] ?? notification disable option in config
  • Subgrouping and randomization for crate contents
  • Item-specific options, such as cooldowns, limits, etc
  • In-game crate creation

GreenCrate Plugin 1.6.4 Download Link

Credits: Greenlock28