Configuration

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) ### ########################################## global: require-crate-perms: false mobs: ZOMBIE: percent-mode: 'Individual' drops: Example1: 100 SKELETON: percent-mode: 'XOR' drops: Example1: lower: 0 upper: 50 Example2: lower: 50 upper: 100 crates: Example1: 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 contents: i101: ID: 256 DATA: 5 ENCHANTMENTS: - 'DURABILITY-2' DISPLAYNAME: 'Blargshovell' LORE: - 'It digs.' - 'Yup.' i102: ID: 35 DATA: 15 AMOUNT: 6 gui: enabled: true chest-rows: 1 label: 'Crate' persistent-items: true Example2: 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 contents: i101: ID: 257 DATA: 25 ENCHANTMENTS: - 'DURABILITY-1' DISPLAYNAME: 'Blargenpikk' LORE: - 'It mines.' - 'Yup.' i102: ID: 35 DATA: 7 AMOUNT: 3 gui: enabled: false chest-rows: 0 label: 'n/a' persistent-items: false
The configuration file is composed of three main sections: global, mobs, and crates.
Global
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.
Mobs
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:
drops: CrateA: lower: 0 upper: 30 CrateB: lower: 30 upper: 60 CrateC: lower: 60 upper: 90
Crates
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, a list of which can be found here. (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.
Comments