The cratest crate plugin of all time
3

Prizes

Prizes are individual things that can be given to a player, such as commands or items. The available types are:

CommandPrize

A prize which executes a command when given. If the command node is present, the prize is matched to this type.

<id> = {
    //name, lore, icon
    command = {
        command = "/<command>"
        source = "server"/"player"
        online = true/false
    }
}

If only the command needs to be specified, prefer setting it directly which will use the default values for the other properties.

<id> = {
    //name, lore, icon
    command = "/<command>"
}

If name/lore/icon are also unspecified, prefer using an inline reference instead of defining a new prize.

Properties

| Name | Type | Description | Default | | — | — | — | – | | name | Text | The prize name, inherited from Component | This prize’s capitalized id, or the command if an inline reference | | lore | List | The prize lore, inherited from Component | The command, or an empty list if an inline reference | | icon | Item | The prize icon, inherited from Component | A filled_map with the above name/lore | | | | command | String | The command, supporting placeholders for either ${player} (if online = true) or ${user} (if online = false) and ${value} | Required | | source | "server"/"player" | The source executing the command | "server" | | online | Boolean | Whether the user must be online to receive this prize. If false, the source must be "server" (since offline users can’t execute commands) | true if the source is "player", else false | | | | value | String | The reference value, which replaces the ${value} placeholder in the command | Required when ${value} is used, otherwise is not allowed |

Referencing

The reference value for a command prize is a value placeholder, which replaces ${value} in the command and is required when ${value} is used (otherwise is not allowed). Commands can also be defined inline using an object.

prizes = [
    ["<command-prize-id>"] //no ${value}
    ["<command-prize-id>", "<value>"]
    {
        command = ...
    }
]

If only the command needs to be specified, prefer using an inline reference instead of defining a new prize.

prizes = [
    ["/<command>"]
]

Examples

Greets the user with a friendly message.

greet = {
    name = "Greet"
    lore = ["\"Greets the user\""]
    command = "/say Hello, ${user}"
}
prizes = [
    ["greet"]
]

Displays a /me action executed by the player

me = {
    name = "Me"
    lore = ["* ${value}"]
    command = {
        command = "/me ${value}"
        source = "player"
    }
}
prizes = [
    ["me", "rolls nat 20"]
]

Says a message from the server.

By v0.1.0, crates and rewards will have built-in broadcasts/messages which should be preferred over using commands.

prizes = [
    ["/say The Server Speaks!"]
]

ItemPrize

A prize which gives an item when given. If the item node is present, the prize is matched to this type.

<id> = {
    //name, lore, icon
    item = {
        type = "<item-type>"
        name = "name"
        lore = ["line1", "line2", ...]
        enchantments = [
            ["<enchantment-type>", <level>]
            ...
        ]
        nbt = {
            <data>
        }
    }
}

If only the type needs to be specified, prefer setting it directly which will use the default values for the other properties.

<id> = {
    //name, lore, icon
    item = "<item-type>"
}

If name/lore/icon are also unspecified, prefer using an inline reference instead of defining a new prize.

Properties

NameTypeDescriptionDefault
nameTextThe prize name, inherited from ComponentThis prize’s capitalized id, or the item’s name for simple items
loreListThe prize lore, inherited from ComponentAn empty list
iconItemThe prize icon, inherited from ComponentThe item with the above name/lore if not specified
typeStringThe item type, in the form <namespace>:<id> with an optional /<data> suffixRequired
nameTextThe item name, which applies to the item given to the userThe item type (default item name)
loreListThe item lore, which applies to the item given to the userAn empty list
enchantmentsList<EnchantmentType, Integer>The item enchantments, which is a list of ["<enchantment-type>", level] pairsAn empty list
nbtObjectThe item nbt, which is arbitrary data (use with caution)An empty map
quantityIntegerThe reference value, which is the quantity of the item givenRequired

Referencing

The reference value for an item prize is the quantity, which is required. Items can also be defined inline using an object.

prizes = [
    ["<item-prize-id>", <quantity>]
    {
        item = "item-type" | { ... }
        quantity = <quantity>
    }
]

If only the type and quantity need to be specified, prefer using an inline reference instead of defining a new prize.

prizes = [
    ["<item-type>", <quantity>]
]

Examples

Gives an apple to the user. The prize itself also has a custom display name and lore, which is used in text/menus but does not apply to the item given.

apple = {
    name = "&cApple"
    lore = ["&7An apple a day keeps the doctor away"]
    item = "minecraft:apple"
}
prizes = [
    ["apple", 1]
]

Gives the player a powerful sword.

monado = {
    item = {
        type = "minecraft:diamond_sword"
        name = "&bMonado"
        lore = ["&f\"Today, we use our power to fell a god...\""]
        enchantments = [
            ["minecraft:sharpness", 10]
            ["minecraft:fortune", 1]
        ]
    }
}
prizes = [
    ["monado", 1]
]

Just a normal cookie.

prizes = [
    ["minecaft:cookie", 3]
]

MoneyPrize

A prize which gives an amount of a currency when given, naturally requiring an economy plugin. If the money node is present, the prize is matched to this type.

<id> = {
    //name, lore, icon
    money = {
        currency = "<currency-type>"
    }
}

If only the currency needs to be specified, prefer setting it directly which will use the default values for the other properties.

<id> = {
    //name, lore, icon
    money = "<currency-type>"
}

If name/lore/icon are also unspecified, prefer using an inline reference instead of defining a new prize.

Properties

| Name | Type | Description | Default | | – | — | — | — | | name | Text | The prize name, inherited from Component | The currency’s format | | lore | List | The prize lore, inherited from Component | An empty list | | icon | Item | The prize icon, inherited from Component | A sunflower with the above name/lore if not specified | | | | currency | String | The currency type, in the form <namespace>:<id> | Required | | | | amount | Integer/Decimal | The reference value, which is the amount of money given | Required |

Referencing

The reference value for a money prize is the quantity, which is required. Currencies can also be defined inline using an object.

prizes = [
    ["<money-prize-id>", <amount>]
    {
        money = "currency-type" | { ... }
        amount = <quantity>
    }
]

If only the currency and quantity need to be specified, prefer using an inline reference instead of defining a new prize.

prizes = [
    ["$", <quantity>] //default currency
    ["$<currency-type>", <quantity>]
]

Examples

Gives a number of tokens to the user. This requires an appropriate currency to be defined with the server’s economy plugin.

tokens = {
    name = "&eTokens"
    lore = ["&6Usable in the Arcade!"]
    money = {
        currency = "<economy-plugin>:tokens" //varies by plugin
    }
}
prizes = [
    ["tokens", 100]
]

Gives the player an amount of money using the default currency.

prizes = [
    ["$", 250.0]
]

Category: Gameplay

Published on Sep 5, 2021

views

stars

watchers

total downloads

Licensed under MIT

Promoted Versions

Members