Skip to content

Latest commit

 

History

History
325 lines (266 loc) · 17 KB

cmi-economy.md

File metadata and controls

325 lines (266 loc) · 17 KB

FAQ - How can I use CMI for Economy?

FAQ Menu

CMI and Bungeecord info-, • Chance example, • CMI Chat manager, • Chat format info, • Chat filter, • Chat rooms, • CMI Commands info, • Custom Join and Leave, • CMI Economy manager, • Event commands, • Extending commands, • Getting started with CMI, • Glow info, • Create custom /help, • CMI Hex colors, • Importing data into CMI, • CMILib library info, • Customizing CMI Locale, • CMI Chat with LuckPerms prefix, • Migrate to MySQL database, • Player stuck in Mode?, • User-moderation info, • More message commands, • MOTD, • Parameters explained, • Ranks info, • Create custom /rules, • Running CMI, • Safety tips, • Specialized commands info, • Toggle example, • Trash example, • CMI Vote manager, • Worth info.

Official Zrips Links
  • Zrips Website
    https://www.zrips.net/
    The official website, wiki/documentation/information
  • Zrips Discord
    https://discord.gg/dDMamN4
    The official Discord community server with member-driven support
  • Zrips Github
    https://github.com/Zrips
    The place for bug reports and feature suggestions
Prerequisites
  • Buy and Download CMI (premium plugin)
    https://www.spigotmc.org/resources/3742/
    Get the CMI plugin if you haven't already, and then install it on all your servers
  • Also Download CMILib (free library) (more info)
    https://www.spigotmc.org/resources/87610/
    All Zrips plugins require the CMILib .jar file. Get it and also put it on all your servers.
  • All my FAQ pages have been written for Spigot / Paper 1.20.x and CMI 9.6.x.x or newer.
  • The mrfdev Github page is not an official resource, we're building up our knowledge base as a courtesy.
  • I am an admin on the Zrips Discord, this does not mean what I share on here is official.

This article also has a video available. https://youtu.be/zX_ddc24Mso


ℹ️ CMI can handle Economy

Economy:
  # Enable or disable CMI economy in general
  # In case CMIInjector is present, then this will be set to true automatically.
  # Attention! For economy to work properly with other plugins you will need ether an injector or recompiled Vault version. 
  # You can find both option at top of plugins page
  # ATTENTION! If you disabled CMI economy while server was running, you will need to perform full server restart for this to take correct effect and avoid any issues while getting players balances
  Enabled: true
  • And finally; /stop the server, and start it up again to guarantee that everything's working properly.

PLEASE NOTE: Everything above this point is enough to use CMI as an Economy engine. Everything below this point is additional information to help you customize and use the economy features for your server.


ℹ️ Using the economy

Once your server starts up and the economy shows properly in /cmi version, you can start using commands such as

Commands and permissions:

/cmi balance (playerName)
-> cmi.command.balance.others - Check money balance
-> cmi.command.balance - Check money balance

/cmi baltop (playerName)
-> cmi.command.baltop - Check top money list
-> cmi.command.baltop.others - Check top money list

/cmi cheque (playerName) [amount]
-> cmi.command.cheque - Convert money into cheque
-> cmi.command.cheque.withdraw - Allows to withdraw cheque balance when option in config file is enabled
-> cmi.command.cheque.admin - Allows to give out cheque with money amount directly to target player without requiring paper

/cmi money [pay/give/take/set] [playerName/all/alloffline] [amount][%rand/1-1000%][1%[min-max]][playerName]] (-s)
-> cmi.command.money - Manage money balance
-> cmi.command.money.betweenworldgroups - Allows money transfer between worlds
-> cmi.command.money.admin - Allows to manipulate player balance

/cmi options (playerName) (option) (enable/disable/toggle/status) (-s)
-> cmi.command.options.[visibleholograms/shiftsignedit/totembossbar/bassbarcompass/tagsound/chatspy/cmdspy/signspy/acceptingpm/acceptingtpa/acceptingmoney] - Allows to modify specific options
-> cmi.command.options.others - Modify personal options
-> cmi.command.options - Modify personal options

/cmi pay [playerName] [amount] (-s)
-> cmi.command.pay - Perform money transaction

Other commands related to CMI Economy can be the CMI Worth and CMI Sell features:
/cmi sell (all/blocks/hand/same/gui)
-> cmi.command.sell.[blocks/all] - Allows to sell items not only from your hand
-> cmi.command.sell - Sell items from inventory

/cmi worth (all/blocks/hand/materialName)
-> cmi.command.worth - Check item worth

/cmi worthlist (playerName) (-missing)
-> cmi.command.worthlist - Check list of items with set sell prices
-> cmi.command.worthlist.others - Check list of items with set sell prices

Placeholders: (that you can consider using)

%cmi_user_balance_formatted%
%cmi_user_balance%
%cmi_user_toggle_[msg|pay|tp|compass|sospy|sispy|cospy|schest|autoflightrecharge|totem|shiftedit]%
%cmi_user_togglename_[msg|pay|tp|compass|sospy|sispy|cospy|schest|autoflightrecharge|totem|shiftedit]%
%cmi_iteminhand_worth%
%cmi_iteminhand_worth_one%
%cmi_iteminhand_worthc%
%cmi_iteminhand_worthc_one%
%cmi_baltop_name_[1-10]%
%cmi_baltop_money_[1-10]%
%cmi_baltop_shortmoney_[1-10]%
%cmi_worth_buy_[itemIdName(:data)]%
%cmi_worth_sell_[itemIdName(:data)]%
%cmi_worthc_buy_[itemIdName(:data)]%
%cmi_worthc_sell_[itemIdName(:data)]%
%vault_eco_balance_formatted%
... (and possibly some more)

Note: You can use /pay, /balance, etc as well by configuring the Alias.yml file.

You can check the commands page and the permissions page to learn which commands and permissions along with them can be part of what you want out of your economy.

Other plugins can now use CMI's Economy engine by hooking into Vault to transfer and store money for players.

ℹ️ Chest Shop / Item Shop / Shop Chest / Admin Shop

It is a bit out of the scope of the CMI plugin to have player shops, admin shops and such, but using CMI's existing features, they dp allow you to do quite a few things that get very close. Personally I still recommend using a dedicated plugin on top of CMI for fully fledged player shops and chest shops. But, that being said, CMI is dynamic, modern, and flexible enough to get pretty far. And maybe it can do just what you're looking for.

Here's an example of using CMI as an item shop: https://www.zrips.net/itemshop/

Using CMI's Holograms, Specialized Commands and Interactive Commands, combined with various commands, the sell feature and the CMI Economy engine, you can have players click on holograms to sell what they're holding. You can even make a block, sign or NPC that can execute commands, give items, take money, or give kits by left/right clicking them.

ℹ️ Player's Balance or Top Player Balances in Holograms.

Player's Balance in Holograms.

You can use /cmi hologram to create a new hologram that shows some placeholders that are personal to the player, for example their balance. Check the Holograms page to learn more about how to use the Holograms in CMI. See the above list of placeholders to learn which placeholders you can use to display the balance of the player.

Top Player Balances in Holograms.

The same as above, but using dynamic placeholders from CMI that can display the top 3 balances on the server.

1. %cmi_baltop_name_1% - %cmi_baltop_money_1%
2. %cmi_baltop_name_2% - %cmi_baltop_money_2%
3. %cmi_baltop_name_3% - %cmi_baltop_money_3%

Hopefully this gives you an indication what is possible utilizing all the CMI features one way or another to make a custom server experience for your players.

Using Worth and Sell in Holograms.

And finally, another example that combines multiple CMI features. You can use a hologram to run commands and to display dynamic placeholders. Using CMI's Worth and Sell features, you can, for example, display what the player is holding, and say how much of that item they're holding, and how much it's worth if they were to sell it. You can also add a command to a hologram that when they right click the hologram it will sell what they're holding, and the money goes to their balance.

Here's an example I use on my servers. Note that the name of the world and the hologram location is specific to my server, and won't work on yours. You'd have to change this if you wish to copy and paste it to use on your own servers.

Worth:
  Loc: world_wild;500.00;65.00;500.00
  Interval: 0.3
  Range: 6
  RangeExtra: 6
  Spacing: 0.22
  SpacingIcon: 0.5
  Interactable: true
  Commands:
  - asPlayer! cmi sell hand
  Lines:
  - '&6 %cmi_iteminhand_displayname% &fx %cmi_iteminhand_amount%'
  - '&bWorth: &e %cmi_iteminhand_worth%'
  - ICON:%iteminhand%

Note: This is from my Saves/Holograms.yml file.

CMI Worth and Sell Features

The CMI plugin also lets you define what an item is worth. There are in-game commands to manage this, and there's even a GUI with items that have no value defined, making managing this a lot easier. But you can also manually customize the Saves/Worth.yml file yourself.

If you give your players access to /cmi sell then what they're holding is either worthless (and won't sell) or it's worth what you've defined.

Please note that if CMI can figure out how to craft an item, it can calculate the worth with a bonus percentage. So if you define how much an iron_ingot or stone is worth, you can ask it to automatically calculate what things crafted with stone or an iron ingot could be worth, saving you even more time.

Find Commands:

> cmi checkcommand worth
[INFO]: --------------------------------------------------
[INFO]: 1. generateworth
[INFO]: 2. setenchantworth
[INFO]: 3. worth (all/blocks/hand/material)
[INFO]: 4. setworth (itemname) -s:(sellPrice)
[INFO]: 5. worthlist (playerName)
> cmi checkcommand sell
[INFO]: --------------------------------------------------
[INFO]: 1. sell (all/blocks/hand/same/gui)

Find Permissions:

> cmi checkperm worth
[INFO]: --------------------------------------------------
[INFO]: 1. cmi.command.generateworth - Auto generate posible item worth values
[INFO]: 2. cmi.command.worthlist - Check list of items with set sell prices
[INFO]: 3. cmi.command.worth - Check item worth
[INFO]: 4. cmi.command.setenchantworth - Change enchantment worth
[INFO]: 5. cmi.command.worthlist.others - Check list of items with set sell prices
---->When command is used on another player<----
Base command required
[INFO]: 6. cmi.command.setworth - Change item worth
> cmi checkperm sell
[INFO]: --------------------------------------------------
[INFO]: 1. cmi.command.sell.[blocks/all] - Allows to sell items not only from your hand
[INFO]: 2. cmi.command.worthlist - Check list of items with set sell prices
[INFO]: 3. cmi.command.sell - Sell items from inventory

ℹ️ Importing Balances From Other Plugins.

It's possible to import player balances from EssentialsX to CMI. Other plugins are currently not supported. More information about importing data into CMI can be found here.

ℹ️ FAQ

  • How can I show money with the least or most detail?

config.yml > search for PaymentWithShorts:

  PaymentWithShorts:
    # When set to true players will be able to make payments by using short amount formats like 10k which results into 10000 and similar
    # In addition 10.2k will result into 10200
    Allow: true
    # List of suffixes we should accept and into what amount it results into
    # Only one letter is acceptable when defining suffix
    values:
    - k-1000
    - m-1000000

The above are the values that I use on my servers, and are not the default values.

  • Can I log money transactions or sales from players?

config.yml > search for LogEnabled:

  # Set to true if you want to log money transfers between players
  LogEnabled: true
  log:
    Unknown: true
    Transfer: true

There's also the option to log /cmi sell transactions under Optimizations:

  # Do you want to record sell hand actions into file
  SellLog: true
  • How can I change how money shows in game?

config.yml > search for: CurrencySymbol:, MoneyFormat: or Placing: under Global:

    # Currency symbol to be used when showing balance or similar
    CurrencySymbol: $
    # Format used for displaying money
    MoneyFormat: '###,##0.00'

Additionally, the following is available:

    # Placing of currency symbol
    Placing: '[symbol][money]'

The above are the values that I use on my servers, and are not the default values.

  • Can I charge people for using commands?

Edit the Settings/CommandCost.yml file. My pro tip is to read the comments at the top of the file carefully. Using a space or an alias can have a big influence.

  • I use BungeeCord, does it sync over the network?

Synchronizing money across a BungeeCord network is not currently possible. However, there is a plugin called MySQLPlayerDataBridge, which supports synchronizing some of CMI's data across a BungeeCord network. You can consider using this plugin on top of CMI in order to synchronize data over your BungeeCord network. More information about CMI and BungeeCord can be found here.


You can find more information about the CMI plugin on the official site: zrips.net/cmi