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.
CMI is flexible and dynamic enough that it can do fancy tricks. One of them is a way to allow you to toggle certain things. This page has some examples to demonstrate how you could learn from them and apply it to your edge case situation.
This one is provided by @dkalaxdk#2228
The example below uses a toggle, to allow you to toggle between two different modes.
Whether this two different ranks, or two different command modes for whatever need you may have.
# First two lines adds the required meta values to the player, if they haven't been created before.
# This can also be done using an OnJoinEvent from eventcommands.
# State is the current state of the toggle, The name means nothing, and can be replaced with whatever you want(Can also be the current rank of the user).
# The toggle usermeta, has to be a meta data value.
# It is recommended to only have one, and then use that for every command, to limit the amount of usermeta needed.
- check:%cmi_user_meta_State%==null! asConsole! usermeta [playerName] add State 1
- check:%cmi_user_metaint_toggle%==null! asConsole! usermeta [playerName] add toggle 0
# The messages can be replaced with whatever command you want to run. (Either permissions change or something like that.)
- check:%cmi_user_meta_State%==1! asConsole! msg [playerName] 1
- check:%cmi_user_meta_State%==0! asConsole! msg [playerName] 0
# The following contains the actual checks.
# Firstly, it checks the current state, and depending on that, uses usermeta to decide whether or not the value should be toggled.
- check:%cmi_user_meta_State%==1! asConsole! usermeta [playerName] add State 1
- check:%cmi_user_meta_toggle%==1! asConsole! usermeta [playerName] add toggle 0
- check:%cmi_user_meta_toggle%==0! asConsole! usermeta [playerName] add toggle 1
#Resets the toggle when done.
- asConsole! usermeta [playerName] add State 0
Turn on night vision, and turn it off, using the /flashlight command, append this at the end of CustomAlias/CustomAlias.yml
and restart
flashlight:
Cmds:
- check:%cmi_user_meta_flashlightToggle%==null! asConsole! cmi usermeta [playerName] add flashlightToggle off
- check:%cmi_user_meta_flashlightState%==null! asConsole! cmi usermeta [playerName] add flashlightState off
- check:%cmi_user_meta_flashlightState%==off! check:%cmi_user_meta_flashlightToggle%==off! asConsole! cmi effect [playerName] night_vision 999 1
- check:%cmi_user_meta_flashlightState%==off! check:%cmi_user_meta_flashlightToggle%==off! asConsole! cmi usermeta [playerName] add flashlightToggle on
- check:%cmi_user_meta_flashlightState%==on! check:%cmi_user_meta_flashlightToggle%==on! asConsole! cmi effect [playerName] night_vision 1 1
- check:%cmi_user_meta_flashlightState%==on! check:%cmi_user_meta_flashlightToggle%==on! asConsole! cmi usermeta [playerName] add flashlightToggle off
- check:%cmi_user_meta_flashlightState%==off! check:%cmi_user_meta_flashlightToggle%==on! asConsole! cmi usermeta [playerName] add flashlightState on
- check:%cmi_user_meta_flashlightState%==on! check:%cmi_user_meta_flashlightToggle%==off! asConsole! cmi usermeta [playerName] add flashlightState off
Tab: false
Using the user meta feature from CMI a temp value can be stored, and then checked against. Allowing you within the same command to manage this value, use it to achieve something unique, including a toggle.