Skip to content

Latest commit

 

History

History
193 lines (151 loc) · 11.8 KB

cmi-specialized.md

File metadata and controls

193 lines (151 loc) · 11.8 KB

FAQ - CMI's Specialized Commands Information

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 page should help explain some of the basics what I personally think is the way to use CMI specialized commands features.


ℹ️ There's already a wiki page

https://www.zrips.net/cmi/commands/specialized/

ℹ️ Condition-Characters Legend

There are a few special condition characters or operators that CMI uses in some specialized commands that help nitpick the outcome. Which is handy, you can check if someone has a permission, and run a command if that is true, or use @ for opposite, so when it's not true.

[@] - happens when Condition is opposite
[?] - informs when condition failed and why
[#] - break up everything when condition is not true

You can use # specifically to stop the rest of the alias from executing i.e:

- check:someFailedCheck#! First command
- SecondCOmmand
- Thirdcommand

In the example above, no commands would be run.

ℹ️ Comparison Operators Legend

When a specialized command syntax requires a comparison you have to stick to a specific set, these all mean different things. Below is an example that uses the same check for balances, and they help you go check against exact matches, bigger or smaller matches, etc. Which can be really helpful.

==      (is equal to) 
!=      (is not equal to) 

>       (is less than)
>=      (is less than or equal to)

<       (is greater than)
<=      (is greater than or equal to)

ℹ️ What makes them specialized commands? (SYNTAX)

Every specialized command is basically a keyword that CMI recognizes, then whatever is behind the : is the condition that should result in a true/false or something logical. And it always ends with an !.

For example:

check:!
perm:!

i.e.

- check:%placeholder%==banana! msg! [playerName] It's a banana!
- perm:cmi.something.permname! msg! [playerName] You have the right permissions!

Each type of "keyword" might have different expectations, the wiki will have examples and more indepth info. This is more to help you understand how a specialized command is specific to CMI and can be used with certain CMI features, such as (scheduler)[https://www.zrips.net/schedule/] / (eventcommands)[] / (aliaseditor)[https://www.zrips.net/cmi/commands/custom-alias/] / (interactive commands)[https://www.zrips.net/cmi/commands/interactive-commands/].

There are a few specific exceptions, such as the ones below.

asPlayer!
asConsole!
delay! 5

i.e.

- asPlayer! warp spawn
- delay! 2.5
- asConsole! cmi heal [playerName]

Here you can see they don't have the : thingy, but they also don't take a condition.

The wiki has way more info about this, go play on a test server with it!

ℹ️ Checking Empty Results

You can check against null and empty results, in case you specifically need to know if a (parameter)[https://github.com/mrfdev/CMI/blob/master/Resources/FAQ/cmi-parameters.md] for example is empty or not.

In case you want to compare value against empty field, use “null” or “[empty]”:

- check:$1==null! msg! [playerName] Please provide an argument
- check:something==[empty]! msg! [playerName] Your argument was empty

ℹ️ Stacking Specialized Commands

Yes, it's possible to stack a couple of them, I would not overdo it. A pro tip for when you really really need to stap loads and it doesn't work or fit, is to make a private custom alias command, feed the info to it, parse things there, and use the results from that to complete this particular command (handy for attachcommands btw)

For example, the easiest stacking is a check if a condition is met, and if someone has a specific permission for example. THEN run a command, but as a console command.

So in this example that would be the use of check:! and perm:! and then asConsole! This is what we consider stacking, and the command only runs if the check: and perm: results to true for BOTH of them.

ℹ️ Reminder: Every line of commands will get executed.

If you make a custom alias command with CMI through /cmi aliaseditor for example, and you add multiple commands to the list, please be reminded that each line will get run. So if you have a check at the top, but then later you should not assume that check is still valid. Recheck, or at least match the conditions. Note that per CMI 9.0.4.x you can also use an if conditional at the top, and then check true or false against that - this could help with more complex more complex conditions. (These are called Statements on the wiki page)

ℹ️ Simplifying your checks example

You can avoid complex situations by breaking it down to PER line checks. They will either be true or false, and when it's true, the command gets executed.

- check:[playerName]==Notch! msg! [playerName] This command get executed because your name is "Notch".
- check:[playerName]!=Notch! msg! [playerName] This command get executed because you are nit "Notch".
- check:%cmi_user_balance%>1000! msg! [playerName] This command get executed because your cmi /balance is more than 1000.
- check:%cmi_user_balance%=<1000! msg! [playerName] This command get executed because your cmi /balance is less than or equal to 1000.

This is great for creating very specific situations, so one user in one group in a particular world will have a different result than someone else from another group in another world (to just randomly mention something..)

You can use this to create "(chance)[https://github.com/mrfdev/CMI/blob/master/Resources/FAQ/cmi-chance.md]" or figure out "random" results or even dynamic "(toggles)[https://github.com/mrfdev/CMI/blob/master/Resources/FAQ/cmi-toggle-examples.md]". Which is great to help you build a mini "crate" addon with just CMI features. Or have dynamic rewards for voting or kits or teleport locations, etc.


ℹ️ Resources

More info about Specliaized Commands: https://www.zrips.net/cmi/commands/specialized/ More info about CMI Paramters: https://github.com/mrfdev/CMI/blob/master/Resources/FAQ/cmi-parameters.md

Contributions

Thank you Zrips for all the help with expanding this feature over time, it's helping the features on my server to be super flexible and dynamic! And for Cloude_LeCaw, Alax, and others from the Zrips Discord Community with helping explain things and help build this particular FAQ page.