MoneyPouchDeluxe

This plugin allows you to create pouches, which contain a random amount of money.

View on GitHub

image
Version Minecraft Folia Java

đź’° MoneyPouchDeluxe

MoneyPouchDeluxe adds pouches that players right-click to win a random amount of any currency, revealed digit by digit in an animated title.

opening

📦 Features

🛠️ Installation

  1. Download the latest version from SpigotMC.
  2. Put the .jar in your server’s plugins folder.
  3. Start the server once to generate the files, then edit them:
    • config.yml: language, sounds, title, transaction log, database
    • pouches.yml: your pouches
    • customeconomytype/: your currencies
    • locale/en_US.yml: your messages
  4. Run /mp reload.

Optional: Vault, PlayerPoints, PlaceholderAPI, Nexo (Nexo requires Paper).

⚙️ Configuration

pouches.yml: pouch tiers

Each top-level key is a pouch id, used by /mp <id>.

moneypouch:
  name: "&#D93663&lMoney Pouch <glyph:icons_money>"
  item: "CHEST"              # a material, PLAYER_HEAD (+ texture-url) or "nexo:<item_id>"
  texture-url: ""            # only for PLAYER_HEAD: the Value, texture URL or hash from minecraft-heads.com
  pricerange:
    from: 5000               # both ends can be won; from == to gives a fixed amount
    to: 15000
  options:
    economytype: "VAULT"     # XP, or the name of a file in customeconomytype/
    permission-required: moneypouch.pouches.moneypouch   # remove the line (or false) for no permission
  lore:
    - ""
    - "&7Between &f%pricerange_from%$ &7and &f%pricerange_to%$"
    - ""

Optional per pouch: custommodeldata, enchantments (minecraft:unbreaking:1), itemflags (HIDE_ENCHANTS), unbreakable.

customeconomytype/*.yml: currencies

The file name is the economy id, so vault.yml is used with economytype: "VAULT".

# customeconomytype/vault.yml
hook: vault                                              # vault, playerpoints or command
transaction-prize-command: "eco give %player% %prize%"   # used by hook: command, or if Vault isn't installed
name: "money"          # shown by %economy%
prefix: "&#57951E$"    # shown around the amount, in messages and in the title
suffix: ""

vault.yml, playerpoints.yml and a diamonds example are generated on the first start. VAULT and PlayerPoints also work without their file, as long as the plugin is installed.

locale/<language>.yml: messages

Pick the language with locale: en_US in config.yml.

prefix: "&8「&6MoneyPouch&8」&7» "      # added in front of most messages
prize-message: "&fYou have received %prefix%%prize%%suffix%&f!"
already-opening: ''                     # '' disables a message
Placeholder Where Value
%prize% prize-message, prize-message-stack, reward-error amount won, with the configured separator
%prefix% / %suffix% prize-message, prize-message-stack, reward-error the economy’s prefix / suffix
%economy% prize-message, prize-message-stack, reward-error the economy’s name
%amount% prize-message-stack, give and receive messages number of pouches
%item% give and receive messages the pouch’s name
%player% give messages the target player
%pricerange_from% / %pricerange_to% pouch lore the pouch’s range

PlaceholderAPI placeholders work in every message too.

đź’» Commands

Command Description Permission
/mp give <pouch> [player] [amount] Give pouches (to yourself if no player) moneypouch.admin
/mp <pouch> [player] [amount] Same, shorter (works like in older versions) moneypouch.admin
/mp give <pouch> * [amount] Give pouches to every online player moneypouch.admin.giveall
/mp list List all pouches moneypouch.admin
/mp economies List all loaded economies moneypouch.admin
/mp reload Reload the config, messages, pouches and economies moneypouch.admin
/mp help List the commands you can use  

Aliases: /moneypouchdeluxe, /moneypouch, /cp, /mpa, /cpa. Command names and aliases can be changed, and subcommands disabled, in commands/moneypouchdeluxe.yml.

⚠️ Permissions

📊 PlaceholderAPI

Placeholder Value
%moneypouch_opened% pouches opened
%moneypouch_opened_<pouch>% pouches of one kind opened
%moneypouch_won_<economy>% amount won in an economy (won_vault, won_xp, …)
%moneypouch_won_pouch_<pouch>% amount won from one kind of pouch

Add _formatted to any of them for the number with separators (%moneypouch_won_vault_formatted% → 1,250,000). Statistics are saved in SQLite, or MySQL with mysql-settings in config.yml.

đź§© Developer API

@EventHandler
public void onPouchOpen(PouchOpenEvent event) {
    // Cancellable, before the pouch is used. The amount is the total for event.getCount() pouches.
    if (event.getPlayer().hasPermission("vip.booster")) {
        event.setAmount(event.getAmount() * 2);
    }
}

@EventHandler
public void onPouchReward(PouchRewardEvent event) {
    // After the payment: event.isSuccessful(), event.getFailureReason(), event.getAmount()
}

MoneyPouchDeluxeAPI.get() gives access to the pouches (getPouches, getPouch), pouch items (createItem, isPouch, getPouchId), givePouch and registerEconomyType for your own currencies.

⬆️ Updating from 1.x

Everything is migrated on the first start; nothing has to be done by hand.

Downloads

GitHub Downloads (all assets, all releases)