Skip to content

Latest commit

 

History

History
117 lines (97 loc) · 7.71 KB

cmi-extending-commands.md

File metadata and controls

117 lines (97 loc) · 7.71 KB

FAQ - How do I extend a CMI command?

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.

There's a video: https://youtu.be/TLKAusnisqs

Make commands even more dynamic and do exactly what you want, using the alias editor.


ℹ️ CMI commands can be extended through the aliaseditor

  • You can go to Saves/Alias.yml and find the command you wish to extend. For example: /clearchat: true, make sure it's set to false, save the file.

  • Then, either blindly copy the below example (instructions at the end) or make your own comamnds using the in-game custom aliaseditor feature. Let's go with that one for educational purposes.

  • /cmi aliaseditor, then press enter, click on the green + icon to enter a name for a new command, we're going with clearchat.

  • Then click on the next green + icon to start adding commands to it. You can use specialized commands, placeholders, commands from other plugins, and cmi commands. Among a few things.

  • Check the below code to see an example of how it looks inside the CustomAlias/CustomAlias.yml file.

  • In the example of /clearchat we're using tab suggestions, a custom permission, using specialized commands to check against parameters entered, and we show different results to players as we do to staff members.

Note: I am not saying this is THE WAY to do this, it's an example to help you learn how to disable the base command from CMI and make your own, so you can extend it. Which is fantastic, because you can use sounds, title or action msgs, bossbarmsgs, a list of commands, you can check against conditionals, use chance, placeholders, check against permissions and more. But this example should help you get started.

  clearchat:
    Cmds:
    - check:$2==inform! asConsole! cmi sound block_anvil_land -all
    - asPlayer! cmi clearchat
    - check:$1==selfclear! asPlayer! cmi clearchat self
    - asConsole! cmi broadcast !&r \n {#orange}----------------------------------- \n &r
    - check:$2==inform! check:$3==null! asConsole! cmi broadcast !{#cerulean} •&l&m &r{#cerulean}• {#feijoa}The chat has been cleared {#cerulean} •&l&m &r{#cerulean}•
    - check:$2==inform! check:$3==tellstaff! asConsole! cmi broadcast !{#cerulean} •&l&m &r{#cerulean}• {#feijoa}The chat has been cleared {#cerulean} •&l&m &r{#cerulean}•
    - check:$2==inform! check:$3==tellall! asConsole! cmi broadcast !{#cerulean} •&l&m &r{#cerulean}• {#feijoa}The chat has been cleared {#cerulean} •&l&m &r{#cerulean}• ($4)
    - asPlayer! cmi staffmsg {#feijoa}Cleaned up chat, reason:{#cerulean}&l $4-
    - asConsole! cmi broadcast !&r \n {#orange}----------------------------------- \n &r
    Perm: true
    CustomTabs:
    - selfclear,selfkeep inform,quiet tellall,tellstaff noreason,user-drama,user-swearing,user-hatespeech,event,broadcast [playername]

ℹ️ How to install these examples?

  • You can install these above examples by opening the CustomAlias/CustomAlias.yml and pasting the code at the bottom. Note that since CMI version 9.0.3.x you can create your own .yml files and store them in the ~/plugins/CMI/CustomAlias/ directory.

  • For best results, stop the server, make your changes, and start the server again. This way commands can register properly and they can be used right away.