Configuration and Example
Configuration and Example:
INFO : Deprecated commands and FAQ.
From the 5.0.0 version, it's not more necessary call the commands with a numeric ascending order, this warning is only for the users who still running the old plugin version. If you are one of this, call every command in the your command.yml file with ascending number. Example :
'1': command: /welcome type: TEXT '2': ecc..
- Registered commands "register: true" needs a server restart to make them effective at 100%.
How to configurate and examples
How to make a "TEXT" command type :
'command_name': command: /welcome type: TEXT text: - '&6 Hello &a$player!' - '&6 Welcome to &a$server-name &6Server!' - '&6 $server-motd.'
- Suggestion It's recommended put any text in the commands.yml inside the apex or quote char,for prevents errors. Example
"command_name": type: "TEXT" text: - "My Text"
The TEXT command type will show only to the player who's run the command.
Broadcast Text (The text get showed to all the players in the server)
Like the example here above, but with a different command type. In this case BROADCAST_TEXT
'broadcast_example': command: /brexample type: BROADCAST_TEXT text: - '&6 Hello online players!'
From the version 5.3.0 you can use the command field broadcast_message_permission_node for send the broadcast message only to certain users (User with that permission)
just add (in your command) :
Alias / Shortcuts commands:
It's possible make an alias in 2 way. The first using the "ALIAS" Type,the second using the "RUN_COMMAND" command type. Example :
'my_alias': command: /l type: ALIAS alias: /list
'my_alias': command: /l type: RUN_COMMAND runcmd: - /list
As a result, those two commands, will return both with /list as output :
Using arguments in a shortcut commands:
This is possible only with RUN_COMMAND command type. Make a new command and place the $arg1 where needed, and it will be replaced with any argument typed in the game chat prompt.
For example, if you type "/vip Name1" using the command in the example below, the command will replace the "$arg1" with "Name1". In this way, the final output will be "/pex user Name1 group set Vip".
You can use multiple arg placeholders "$arg1..$arg2..3..ecc" in a command, just having attention to put those placeholder in ascending order.
'vip_shortcut': command: /vip type: RUN_COMMAND runcmd: - /pex user $arg1 group set Vip
P.S: Very old image :D
- - - - - - - - - - - - - - Multiple commands with args: - - - - - - - - - - - - - -
Like the previous example, but with multiple $arg(s)
'define_an_region': command: /wgdef type: RUN_COMMAND runcmd: - //expand vert - /region define $arg1 $arg2
Another example :
'lb_rollback': command: /rollback type: RUN_COMMAND runcmd: - /lb rollback player $arg1 time $arg2 - /ban $arg1
- - - - - - - - - - - - - -
Make a command shortcut with $multiargs :
The $multiargs placeholder, gets all arguments typed in a command. If you don't need put "$arg1, ecc"in a specific position, use this one instead.
'your_command': command: /s type: RUN_COMMAND runcmd: - /say $multiargs
Eventually, you can put the $multiargs after some $arg's. Example:
runcmd: - /myban name:$arg1 reason:$multiargs
In this way, $multiargs prints only the arguments typed after $arg1.
Require all arguments?
You can choose if your command need to type all arguments using this command field :
'your_command': ... require_all_arguments: true
Example : If your command have "$arg1..$arg2 and 3" and you type /command one two, the plugin block you the execute it, because he need all the 3 arguments, so /command one two three.
Specific number of arguments? use required_args.
Differently from "require_all_arguments", this allow you to add the "check", on every command type, and give you the ability to be more specific. The "automatic" system in runcmd, works per line, so it's not very efficent, this is a good replacment.
'your_command': ... required_args: 2
In that way, the command starts only if the player write atleast 2 arguments. Example "/command do something".
Custom error message & permissions:
You can manage the error message (invalid args) and the permission (error and node) with the "error-message:", "permission-node:" and "permission-error:" command field. Put this two parameter in the your command and customize it like in the example :
'time_shortcut': command: /t type: RUN_COMMAND runcmd: - /time $arg1 world error-message: '&cType /t day' permission-node: custom.custom permission-error: 'My custom message'
By default all commands use permissions.
You can manage it with permission-node and permission-error message, but it's also possibile disable it by command, using the "permission-required" command field. Put it on false, if the command must not have permissions.
So, here an example :
'no_permission_example': command: /freecommand type: TEXT permission-required: false
By default, if you don't set any permission, the plugin put one automatically on it.
The default permission depends on what configuration you are using.
On the newer version of the plugin, the default permission is "mycommand.cmd.command_name", where "command_name" is the first section of the command.If you see the example here above, the command name is "no_permission_example", so the final permission become: "mycommand.cmd.no_permission_example".
Instead in the olders plugin version (<5.2.7), The default permission change according to the command position. Where position = the ascending position of your command in the config. Then : "mycommand.cmd.position". If you want use this method on newer plugin versions (Not Recommended), you can change the setting value in config.yml.
You can know it typing in the game or console /mycmd list or /mycmd check
N.B. If you are using "register: true", the permission-error message isn't able to replace the custom placeholder, like $player ecc. Because those are stored in the command itself, and when the error happen the event isn't even arrived to MyCommand to allow it to replace the placeholders.
Multiple command type's in one command
From the release of MyCommand 5.6.0+, you are able to put more command TYPES to one command.
To do so, instead of placing the TYPE right afer "type", put them below like a list.
command_name: type: - TEXT - RUN_COMMAND
Not every type works well togheter or work at all, but overall, if you want, it's here. The example above, is one of the various combination you can do.
Item Cost function, how to use:
Example of use :
INFO: On newer plugin versions (>4.0.0), you must use the item name instead of the item ID. So, if in the previous plugin version "itemcost" line is '4:5', in the newer become "COBBLESTONE:5".
Example of use :
'ic_example': command: /itemcostexample type: TEXT text: - 'This command cost 5 cobblestone. ITEM_NAME:AMOUNT' itemcost: 'COBBLESTONE:5'
If you want, you can change the default message using success-message or error-message field. Example:
cost_example: command: /costexample cost: 5 success-message: "&aPaid &7%s $" error-message: "You need %s $ for perform this command!" itemcost_example: command: /itemcostexample itemcost: "COBBLESTONE:5" success-message: "&aSpent &7%s %s &aon this command" error-message: "You need %s %s for run this command!"
From MyCommand 5.4.2, this feature now now support multiple, or the ItemName Displayed as variable.
or with the DisplayedName
itemcost: IRON_SWORD:1:SUPER IRON SWORD;GOLDEN_CHESTPLATE:1:&eULTRA ARMOR
Register Real commands and the Tab Completer
Why register a command?
Registering a command, give you some vantages, like the ability to perform this new created commands in another plugin.
Another plus is, the Tab Completer. This is available only if the command is registered.
So, how to register a command then?
You can do that, by adding the command field : "register: true" or "registered: true" inside the command you want to register.
'registered_command': command: /buycraft-pack1 type: RUN_COMMAND runcmd: - "/say The player $arg1, have just buyed the Pack1 from the store!" register: true
Another one, this time with the TabCompleter
'gm_alias': command: /gm type: ALIAS alias: /gamemode register: true tab_completer: - survival - creative - adventure
In this example, you can see the TAB Completer. This function works only if the command is registered. Like the example, if you type in the game chat "/gamemode" and then press TAB, it will return to you with the tips inside the tab_completer command field, so "survival, creative ecc".
By default, if you don't set the tab_completer field in the command, when you press TAB it will return with the list of the connected players. For now, you can't have both.
Advanced use of the TabCompleter (>5.5.1) :
tab_completer can be customized by positions following the scheme here forward.
There is a special PlaceHolder for the tab_completer only : $player_list (It returns with a list of the online players)
tab_completer: 1: - set - add - remove 2: - $player_list 3: - money - gold - credits 4: - amount - $rnd6
In this example instead, every position of the command typed in the chat prompt, will return with different informations. ALWAYS use numbers in an ascending order 1,2,3... .
Example, if in the chat i have "/manageuser _" where "_" is the prompt position, the auto completer above the chat will show me "set , add and remove". Again, if i have "/manageuser set _", in the following case, i will have the list of the connected players in the server, because the placeholder "$player_list" does this. And so on.
P.S.You can't register (REGISTER : TRUE ONLY) commands with spaces in the name.
command: /test example (WRONG) -> command: /testexample (CORRECT)
REGISTERED commands can't be created with multiple arguments in the command field, only non-registered ones can.
Block commands with a Permission (also Vanilla Commands)
Put "ADD_PERMISSION" or "ADDPERMISSION" argument in "type" field on your command.
Set the command in "command" line.
'block_pl': command: /pl type: ADD_PERMISSION permission-node: blocked_commands.pl permission-error: '&cNope'
How to make delayed commands/pause
You can use the $delay$ prefix, only in the RUN_COMMAND command type.
To use this feature, just put $delay$ as a prefix of the command (Check the example below)
'1': command: /delayexample type: RUN_COMMAND runcmd: - $delay$/time day - /say oh, the light, finally! - $delay$/time night - /say just joking! It's night again! delaytimer: 5
Another example :
'2': command: /delayexample2 type: RUN_COMMAND runcmd: - $delay$/broadcast 5.. - $delay$/broadcast 4.. - $delay$/broadcast 3.. - $delay$/broadcast 2.. - $delay$/broadcast 1.. - /broadcast Welcome in $player Event at X-$locX Y-$locY Z-$locZ! - /tpall $player delaytimer: 1
How you can see, there is an command field called delaytimer. Use it for set how many time needs to elaps when $delay$ is used. The number is express in seconds. So " delaytimer: 1" = 1 second of pause.
If you need more accuracy, it's possible change the delaytimer field from seconds to ticks.
Using delaytimer_format in the command field, you can switch from SECONDS to TICKS
(20 server Ticks = 1 second)
Example: delaytimer: 20 delaytimer_format: TICKS
P.S. You can use also $delay$ alone in a line if you need to, without the necessity of placing an action after it.
From the version 5.3.3 (or newer), you can use a custom timing on each "$delay$" prefix.
This value must be written only in "ticks". (20 ticks = 1 second).
- Example : $delay$<60> or .... $delay$<$randomnumber%60%>
'custom_timings': command: /customtiming type: RUN_COMMAND runcmd: - "$text$The command will be executed in 3 seconds..." - "$delay$<60>" - "/command"
runcmd: - "$text$If you are lucky, this command takes only 10 seconds for be executed... or just wait 1 minute" - "$delay$<200>" - "$delay$<$randomnumber%1000%>" - "/command"
How to set Warmups and Cooldowns
Cooldown or warm-ups for custom commands (ONLY commands created with MyCommand)
cooldownhere: command: /command type: TEXT ... cooldown: 5
cooldownhere: ... warmup: 5
Instead, if you need to put a cooldown or a warmup to another plugin command, see below :
1. Put "WARMUP" , "COOLDOWN" or "WARMUP_AND_COOLDOWN" in the "type" command field.
2. Write the command where you want apply the warmup or cooldown typing it in the "command" field line.
3. And set the time (in seconds) with "delaytimer" line.
See the example:
'warmup_example': command: /spawn type: WARMUP delaytimer: 5
Cooldown example: (If you need that, you can use also "success-message" with the cooldown type)
'cooldown_example': command: /warp type: COOLDOWN delaytimer: 60 success-message: "Teleported!"
Warm-ups can be canceled on the move event. Put true on MOVE_LISTENER in the main config.
(It's disabled false by default, once changed, restart the server)
WARMUP_AND_COOLDOWN apply both the effect to one command
Cooldowns can be stored in a yml file to not lose them when the server get restarted or stopped.
Use DEBUG.SAVE_PENDING_COOLDOWNS in the config.yml for manage this function. (true/false).
cooldown-message: "wait %s second more" Allows you to costumize the cooldown message
(Old version of plugin <5.0.0,support only warmups and the type is "type: addtimer" )
To use the economy features with mycmd commands, you need an economy plugin and the Vault plugin.
The use it's simple, just change the config line "cost" in the interested command.
This example withdraw 5$ from the player sender.
'economy_ex': command: /takemymoney type: TEXT text: - "&2Thanks!" cost: 5
If you need to be more specific, use a decimal value, by placing the dot character. "."
To allow players to use the command, also if they don't have the required money to do that, you can by allowing the debts. Change the "allowdebit:" to "true" in the main config.yml.
Can i add the economy cost to another plugin command? Yes, create a new command and set the type to ADD_COST. Example :
'mykit_command': command: /kit type: ADD_COST cost: 500
#(Be aware who in this case MyCommand can't know if the output command will give a successful result. MyCommand will always withdraw moneys independently from the result)
Perform a command by the console from a player sender. RUN_CONSOLE
Same as RUN_COMMAND type, but all the commands, are performed from the console. This allow's you to run command even if the sender isn't in possess of the necessary permissions. Take in mind who not every command works from the console, and not every command act as the in-game counterpart.
And yes, be aware of the fact that if you put "/op $player" the player will actually get OPPED, so caution.
One example of use:
'run_by_console': command: /goto type: RUN_CONSOLE runcmd: - /tp $player $arg1 - /money take $player 500
Using the placeholder $RUN_CONSOLE$ (5.6.0+)
The $RUN_CONSOLE$ prefix. Allow's you to run command by the console, per line, where required.
runconsoleplaceh: command: /rcph type: RUN_COMMAND runcmd: - "/runthisfromgame" - "$RUN_CONSOLE$/andmefromtheconsole"
Message Tooltip/Suggest Command with RAW_TEXT
You can use RAW_TEXT commands for suggest commands and hover text over a message. This command type works only on Spigot servers. (No CraftBukkit).
Create your command like an normal TEXT one, like in the example, and use the ";" char for split the Chat Text from the Hover and the Suggested Command.
rawmessage_example: command: /raw1 type: RAW_TEXT text: - '&aHello &b$player! &aHover your mouse over me!; &dMAGIC' - '&0[&d*&0]&e Click me; &eClick Here for suggest the command &d/mycmd;/mycmd' - '$RUN_COMMAND$&0[&e*&0]&c Set the time to day; &eClick for Execute;/time set day' - '$OPEN_URL$&0[&e*&0]$random_color Open Google.com; &eClick for open;http://www.google.com'
So : MESSAGE ; HOVER MESSAGE ; SUGGESTED COMMAND.
If you want, you can create commands with only the Hover message, just removing the ;suggested part. Example :
MESSAGE ; HOVER MESSAGE.
You can change the Click Event from Suggest to $RUN_COMMAND$ or $OPEN_URL$ For do this, put this 2 string at the start of the your command, like the example above.
Change the type to BROADCAST_RAW_TEXT, for send the message to every connected player.
how i can create 2 or more different hover/click part in one line?
- You can do that, just splitting them with the < and > as separator.
- Example :
'&aTEXT_1 ;HOVER OF TEXT 1$OPEN_URL$&bTEXT_2;HOVER OF TEXT 2;http://www.example.com'
Can i have multiple line in the hover part?
- Yes, you can split multiple lines in the hover part with < newline > as separator.
- Example :
- Also, in the hover part, you can use this 2 placeholder to show an Item or an Entity. ($SHOW_ITEM$ and $SHOW_ENTITY$)
- Example "Hover on me:$SHOW_ITEM$STONE"
LIVE_CHAT . Make the chat a live prompt.
Basically the chat become a prompt. Until the player gives the correct answer it will asks for it. If correct it will launch a command.
(Note: runcmd here is working only as a list, it hasn't the features of a RUN_COMMAND.) Use it in conjunction of execute_mode to be able to concatenate more commands and more questions.
If you want to use this feature, you need to enable the "CHAT_LISTENER: true" in the main config.yml. Done that, restart the server.
live_chat_example: command: /livechat type: LIVE_CHAT text: - "&aHow much is '2 + 2'" - "&aWrite your answer in the chat!" answer: "4" success-message: "&bQuick math!" runcmd: - "/me minus 1 that's 3!"
Launch randomly a command choosen from a list
Use command type : RUNCOMMAND_RANDOM or RUN_CONSOLE_RANDOM to run a randomly choosen command from the runcmd list.
command_name: command: /cmd_name type: RUN_CONSOLE_RANDOM runcmd: - /prize 1 - /prize 2 - /prize 3
Launch a command as operator
This command type give a temporary OP status to a sender player for executing a command
(USE AT YOUR OWN RISK)
'give_stones: command: /stonepls type: RUN_AS_OPERATOR runcmd: - /give $player 1 64
All the times MyCommand give the op status to a player, a log in the console is written. For extra security, an extra task get launched every time, for remove the OP status after some seconds (just in case, if you made mistake with the command and give him permanent op status).
Setup MYCMD Button, Pressure Plate, Lever, Door , Detector Rail or your Customs
Type /mycmd-blockset in game chat to see the help menu.
1. Place your button, pressure plate or any block you have enabled in the config.yml
2. Look at the target block you want use and type /mycmd-blockset create
3. If created with success, you can now add commands with /mycmd-blockset add <command></command>
4. That's it. test if it works by interacting with it.
- Show block info with: /mycmd-blockset check
- Remove all commands from a block : /mycmd-blockset delete
- Remove a single command from a block : /mycmd-blockset remove
- Switch type from Player/Console : /mycmd-blockset switch
From MyCommand 3.9.0 and above, you can manage the block name id. Check in the config.yml.
How to disable a command only on certain input. disable_on
This feature allow's you to disable the command if the typed-in command match the one inside the "disable_on" list
pets: command: /pet type: RUN_COMMAND runcmd: - '/shop pets' disable_on: - /pet summon creeper
In the example here above, if the player type-in /pet, the original pet command will get replaced as "/shop pet".
Now, assume we need to disable this command to not run "shop pet" in determinate circumstance, you can do that with disable_on. In this way, if the player type in "pet summon creeper", the original command get executed.
How to use allowed_worlds
You can use the "error-message" line for put an custom error.
'onlyinthenether': command: /onlynether type: TEXT text: - "&cYea,The Nether!" allowed_worlds: - world_nether error-message: "This command is not accessible from this world"
Repeat multiple times text or commands.
Put '%Repeat%n% before the command/text.
clearchat: command: /mycmd-clearchat type: BROADCAST-TEXT text: - '%Repeat%30% ' or runcmd: - '%Repeat%30%/dosomething'
How to use "$world=%world_name%" in RUN_COMMAND Type
'per_world_commands': command: /perworldcommand type: RUN_COMMAND runcmd: - "$world=%world%/me This command will be performed only if you are in the world" - "$world=%world_nether%/me And this only if you are in the nether" permission-required: false
How to use "execute_mode" command field.
If you want made an command performable only from several source,you can use this function.
There are multiple types, here listed :
NORMAL BLOCK_ONLY FROM_ANOTHER_COMMAND NPC_ONLY CONSOLE_ONLY
'only_from_block': command: /onlyblock execute_mode: BLOCK_ONLY type: TEXT text: - "This command can be called only from /mycmd-blockset" 'only_from_command': command: /onlybycommand execute_mode: FROM_ANOTHER_COMMAND type: TEXT text: - "This command can be called only from another mycmd command"
Possible CONSOLE_ONLY Example :
Creating an reward command for all players, triggered by BuyCraft. The eco command need to be executed from the console (permission reason).
console_executefor_test: command: /extest1 executefor: ONLINE_PLAYERS type: RUN_CONSOLE runcmd: - /eco give $player 5000 permission-required: false execute_mode: CONSOLE_ONLY register: true
How to use "executefor" command field.
Supported types :
SENDER (Execute the command only for the sender)
ONLINE_PLAYERS (Execute the command for every player online)
WORLD_PLAYERS (Execute the command for every player in the same world of the sender)
'executefortest': command: /executeforall type: RUN_CONSOLE executefor: ONLINE_PLAYERS runcmd - "/tp $player 0 64 0" permission-required: false
Basically works with every command type, except ADD_PERMISSION
(By Default every commands it's on SENDER type) (maybe, some of this options can made some loops if used wrongly.)
Custom Logger $log$ (file.log) 5.6.0+
It's now possible save logs text in separate log file. Just use log_filename: "filename.log" like the exampel here below, and the $log$ message will get saved in "/plugin/MyCommand/logs/filename.log"
my_custom_logger: command: /mylog type: RUN_COMMAND runcmd: - "$text$&aThis log file is getting saved in &2/MyCommand/logs/filename.log" - "$log$[$player] $multiargs" log_filename: filename.log
In-Game Items (Itemset)
How to Use : (>5.1.4+)
- First of all, active the item event with "/mycmd-itemset on".
- So, get an item in your hand and type "/mycmd-itemset add" for add it to active item(s) list.
- Now if you click left or right mouse button it's possible read in chat about the item without command in it.(If you don't want this message put "empty_message" field in itemset.yml on false.
- Now for add something on the activated item, type, for example, "/mycmd-itemset right /list". In this case if you use the right click of the mouse, the server runs the command "/list" for the player who send this action.
- Same thing with "/mycmd-itemset left /your command", but in this case the command will be performed only if you use the left button of the mouse.
- You can add multiple commands in one line using the ";" char between each command. Example : /command1;/command2
- And that's all for made it working.
- Now if you need to run this command only on a specific item with a specific name, you can set an name on the your item with the command "mycmd-itemset name NewName".
- For more command(s) type "/mycmd-itemset" in-game
How to Use : (Old<5.1.4+)
First of all, active the item event with "/mycmd-itemset on".
So, type /mycmd-itemset without arguments on the interested item.
Now type the command(s) to run(s) on the current item with:
If you want to execute more commands in one use the ";" char for separate the commands,Example:
/mycmd-itemset //expand 10 up;//expand 10 down
You can also use arguments in commands, like:
- $targetentity (OLD VERSION <5.0 is : $targetplayer) (get the name of player right clicked)
Possible use : /mycmd-itemset /jail $targetentity
If you want, it's possible save and load when you want a saved set. Also when the plugin starts. See itemset.yml.
Make a MYCMD Sign
On Sign you can :
- Execute the command by right-clicking on sign.
- Show the messages you put on the sign on game chat.
- How to Use :
Put [MYCMD] in first line of sign
In Line 2,3,4 insert your /command or text
Final Result :
- How to Use :
You can change the sign header from config file : (default) signheader: [MYCMD]
From the 5.0.0 version, you can create lists of commands with the /mycmd-signset command ! Create a new list,put the command in it,and when you create an sign,put the name of the created list on the 2°,3° or 4° line of the sign.
This feature will spawn a floating text in front of the player sender.
Command type : HOLOGRAPHIC_TEXT and BROADCAST_HOLOGRAPHIC_TEXT . Use the second one to show the text to every connected player.
holographic_example: command: /holoexample type: HOLOGRAPHIC_TEXT text: - "&eHello $player, how are you?" - "$random_coloryeah, i'm fineeeee thanks!" - "&dCurrent time &5$time" delaytimer: 3
delaytimer, adjust the time needed to show the next line of text.
MOVED, Check the navbar ->
INFO: Older version of the plugin (<5.3.3), Uses a different character for split the "amount" part from the "text". This means, on MyCommand 5.3.3 and newer, the correct code is "$health;Health level:"
Instead, on older version (<5.3.3), the correct code is "$health:Health level". What changed? The split char in the new version is ";" and not ":".
- The Scoreboard will get removed after DelayTimer(sec). If 0 don't remove
- Use $marquee$ as a prefix of the scoreboard name for scroll the text.
- Use scoreboard_refresh_ticks, for determinate how frequent the plugin have to update the scoreboard.
Dynamic scoreboard :
scoreboard_example: command: /sbexample type: SCOREBOARD scoreboard_name: "$marquee$&1M&2y&3C&4o&5m&6m&7a&8n&9d &aS&bc&co&dr&ee&fb&0o&1a&2r&3d &nExample&r " scoreboard_text: - "4;&c&lCoordinates:" - "3;&6X:&e $locX &6Y:&e $locY &6Z:&e $locZ " - "2;&c&lPlayer Info:" - "1;&6Health: &e$health" - "0;&6Food: &e$food" scoreboard_refresh_ticks: 5 delaytimer: 10
For a static scoreboard just don't use "scoreboard_refresh_ticks".
'1': command: /sbtest type: scoreboard text: - 'Remove scoreboard after DelayTimer(sec) - 0 = never' scoreboard_name: '&bTest' scoreboard_text: - '$randomnumber%1000%;Lucky' - '$exp;Exp' - '$level;Level' - '123;Text with max 40 chars' cost: 0 delaytimer: 5
INFO: you can use the $marquee$ prefix without using scoreboard_refresh_ticks.
Other function :
scoreboard_rendertype: INTEGER (by default is this one)
Http Get Request (CALL_URL)
Use this function for send a GET request to a web page.
Command Example :
'call_url': command: /call-url type: CALL_URL url: http://localhost/yourscript.php?user=$player get_output : true show_output_ingame : true save_output_as : httpResponse
- url : Put your url here, works with every variable of mycommand,like $player $arg1,2, ecc
You can split the lines with "" in the html\php page. Example:
- get_output : <true/false> #Get the page output (Default false)
- show_output_ingame : <true/false> #Show the output in the game chat (Default false)
- save_output_as : #Save the output in playerdata.yml (For use it later in another command) (Default empty = save nothing)
- user_agent: Mozilla/5.0 #Change the User Agent
"POST" request method.
use "http_request_method: POST" as a command field, for set it up. (By default http_request_method is "GET")
and "post_parameters: user=$player&password=12345" for send data.
Executing BungeeCord Proxy commands (5.6.0+)
1. Place the MyCommand_BungeeCord.jar file inside the BungeeCord plugin folder
2. Open the config file of the Main MyCommand (config.yml) and put PLUGIN_MESSAGE_LISTENER on true
3. Done. Restart proxy and server.
How to use in MyCommand Spigot side.
Use those placeholder at the start of a runcmd line to execute commands on the BungeeCord Proxy. Or use /mycmd bungee (to debug stuffs).
bungeecord_bridge_example: command: /bcb_execute type: RUN_COMMAND runcmd: - "$bungeecord_execute$command_to_execute_on_the_proxy" runcmd: - "$bungeecord_runasproxy$command_to_execute" #It run's the command's as the proxy and not the player. This is like RUN_CONSOLE, it will bypass any permission. runcmd: - "$bungeecord_chat$Chat as a player or execute /server commands NOT PROXY one's" runcmd: - "$bungeecord_message$PRIVATE MESSAGE to the sender" runcmd: - "$bungeecord_broadcast_message$BROADCAST MESSAGE on whole PROXY"
If you have a server with BungeeCord Proxy, use this function for make teleports command from one server to another.
- Command type : BUNGEE_TP
- server_name: Put your server name here (You can find the name in the bungee config, or type /glist)
Command Example :
bungeecord_example: command: /hub type: BUNGEE_TP server_name: hub
Use /lmcmd Commands
(This command it's deprecated,but it's here if you want use it)
1. Create a new list of commands by typing : /lmcmd create
2. Add the commands in your new empty list with : /lmcmd add (with slash if you want to use this in-game)
3. Perform the list of commands with : /lmcmd run
Other commands: - Show all command list with : /lmcmd list
- Remove a list of command with : /lmcmd delete
- See information of a list with : /lmcmd check
- Remove a single command from a list with : /lmcmd remove
Type & PlaceHolders
Page Moved, check the NAVBAR on the right ->
Playerdata feature and MYSQL support
Like the custom variables feature, but here the information can be stored for every specific player.
Try "/mycmd-playerdata" in-game to see all the commands available in-game. And check the Script page for some examples and useful scripts.
- /mycmd-playerdata check PlayerName (Returns with all the stored variables for that specific user)
- /mycmd-playerdata set PlayerName coins 10 (This will create or override that variable with the new value.)
- /mycmd-playerdata PlayerName coins 10 (Works with numbers obviously to add or subtract, 10 in this case)
- /mycmd-playerdata removevariable PlayerName varname (Delete a variable from the database)
- /mycmd-playerdata deleteaccount PlayerName (Delete everything from a player)
To utilize a SQL database for MyCommand PlayerData feature, you need to set-up a connection. For do so, you need to update the lines in config.yml with your database information. Put USE: true, and a working database name and server location.
MYSQL: USE: false HOST: 'localhost' PORT: '3306' USERNAME: 'username' PASSWORD: 'password' DATABASE: 'MyCommand'
For both, variables and playerdata you can store them also creating a section in the config file. Just split the variabile with an dot ".". Example : /mycmd-playerdata set Ivanpro home.loc_x 10
home: loc_x: 10
Can i change the NoData return result if a variable is empty or doesn't exist?
Using PLAYERDATA_ERROR_MESSAGE language string in language.yml you can. But be aware who that it is used in some crucial check, so don't use strange characters here.
Leaderboard command type for playerdata
Sort playerdata number values by the highest amount. Configure it using the new field "playerdata_value" , "leaderboard_size" and "leaderboard_text"
PlaceHolders : $index , $username , $points
leaderboard_coins: command: /topcoins type: - TEXT - LEADERBOARD text: - "&dCoins Leaderboard :" playerdata_value: coins leaderboard_size: 20 leaderboard_text: "&a$index: &b$username &a- &b$points"
WorldGuard Region support
Add allowed_wg_regions or blocked_wg_regions in you command fields for allow o block single or multiple regions.
allowed_wg_regions: - test2 - test3 Or : blocked_wg_regions: - test4
If you need to be more specific, there are 2 placeholder to check if the player to check is owner or member of the zone he's currently in. $wgisowner and $wgismember . Use them in conjunction of if/else script to determinate what to do (they return true or false).
BarAPI / BOSS BAR Features
This functions works without external plugin on MyCommand 5.1.8 or above. If you have an older version, you need to download BarAPI. BarAPI plugin. Download and put it in your plugin folder (ONLY for older version of MyCommand.
There are 2 command types. BAR_API_TEXT and BAR_API_BROADCAST_TEXT. Use the first for send the message only at the sender or use the broadcast type for display the message to everyone.
Example of use :
You can use "bar_seconds" or "bar_percentage" for manage the boss bar on older version of Mycommand
and with the newer you can also use : bar_color, bar_style, bar_flag.
+ BossBar supported colors : BLUE,RED,GREEN,PINK,PURPLE,WHITE,YELLOW
+ BossBar Style : SEGMENTED_6,SEGMENTED_10,SEGMENTED_12,SEGMENTED_20
+ BossBar Flag : PLAY_BOSS_MUSIC, DARKEN_SKY, CREATE_FOG
bar_text: command: /bar_example type: BAR_API_TEXT text: - '&aHello $player' bar_seconds: 5 bar_percentage: 8 bar_style: SEGMENTED_20 bar_flag: DARKEN_SKY bar_color: PINK
'bar_btext': command: /bar2 type: BAR_API_BROADCAST_TEXT text: - "Hello everyone!" - "%remove%" bar_percentage: 9
If you put the bar_second on 0, the bar never go away.Use %remove% for remove it, in a separate command, or replace it with another new bar.
Default time without declare nothing is 3 second, after this time the bar go away.
Setup the Scheduler
(The scheduler is not supported and maybe outdated). First : Active the scheduler from config file with :
SCHEDULER: ENABLED: true
Now,you can setup your date format (optional):
DATE_FORMAT: d M yyyy
d = day , M = month , y = year. For example d M yyyy = 1 12 2012.
Setup the initial timer for the first check in seconds :
For the last,set the scheduler timer in minutes:
Config it's ready,now use the /mycmd-scheduler in game.
Create a new scheduler list with /mycmd-scheduler create test
Add a date,or "always" for setup the date,example : /mycmd-scheduler add test date 5 12 2012 (5 december 2012)
Now setup the commands with /mycmd-scheduler add test command /pex user User group set Member
See the other command in the commands page.
P.S.:The Scheduler doesn't work with custom commands, so register the command before or use it for other plugin commands.
Spout Plugin Features
Make a notification "spout-notification" type commands:
'1': command: /testspout type: spout-notification text: - '&4Header' - '&6Hello &a$player!' - 322
In the last line put the Item by ID (integer).Ex: 1 = stone.
Make a "spout-text" type commands:
'1': command: /testspout type: spout-text text: - §a[MyCommand spout-text output!] - §2Simple - ecc..
Before to start using this function, you have to enable the NPC's listener in the config.yml.
- For create a new NPC, just look where you want spawn the new one, and type /mycmd-npcs create
- An number (ID) of the new NPC will be showed in the chat. Take note and use it in the next command(s).
Every command require the ID for edit the NPC.
- An number (ID) of the new NPC will be showed in the chat. Take note and use it in the next command(s).
- For example, if you want add an command to the your new NPC, you have to type /mycmd-npcs add 1 (where 1 is the ID of the your NPC)
- Instead, use /mycmd-npcs remove 1 or /mycmd-npcs remove 1 clearall , for remove one or all the command sfrom one NPC.
- If you lose the id of one NPC, you can find him in the command /mycmd-npcs entities. An full list of created entities will be showed. For make it faster, you can use the command /mycmd-npcs tpto for teleport to the desidered NPC.
- For fully remove, so delete an NPC, there is the command /mycmd-npcs delete
- There is more command and function you can use, like AI (on-off), Glowing effect(on-off), Collidable(yes-no), Type of the NPC, Position and the Name of the NPC. Find all this command in the "/mycmd-npcs" help page.
Send a Title (to Player or Broadcast)
This command type is able to send a Title message.
title_test: command: /title_test type: TITLE text: - '&aHello &e$player' - 'Sub-Title'
Change the type to BROADCAST_TITLE to send the title to all the online players
How to use custom fadein, fadeout and stay time variables. Put the time in (seconds)
title_test: command: /title_test type: BROADCAST_TITLE text: - "&aHello i'm &e$player" - "and i'm talking to you" title: fadein: 3 stay: 10 fadeout: 2
More fancy stuff, there is a dynamic way to show the title, activated by using
The effect 1 will print the message letter by letter.
dynamic_title_example: command: /dyntitle type: TITLE text: - "&aHello &e$player" - "This will be printed one letter at the time." title: effect_type: 1
Create a Task with RUN_COMMAND_TASK
If you need to execute one command multiple times in "loop" you can use this function.
Create a command as always you do, with the RUN_COMMAND type, changing the type to RUN_COMMAND_TASK.
Then edit the parameters you need to manage better the "task" :
If true, the command will be performed instantly. Instead, if false, the first execution of the command is after "task_repeat_every_sec" seconds.
Determinate the seconds between one task and the next one.
Determinate how many times this task have to get executed.
Put task_run_n_times: -1 for make it unlimited.
If true, when the player who performed this command go offline, the command(s) in the list continue to get executed also without the player in the server.
If true, print the message in console, every time MyCommand start a new task
Command example :
taskexample: command: /taskexample type: RUN_COMMAND_TASK runcmd: - /do something task_run_immediately: true task_repeat_every_sec: 5 task_run_n_times: 10 task_run_when_offline: true task_show_debug: true
Use the command /mycmd tasks , to see all the active tasks.
If you need to stop some tasks for one player, use the command /mycmd tasks cancelfor
if you need something more, with RUN_COMMAND_TASK there is an while "$Script$%while%" statment you can use. Check the script page for an example.
Send an ACTION_BAR message.
Works only on Spigot servers
- put your text in "text" lines. Use $delay$ between every text line for send more messages.
action_bar_example: command: /actionbar type: ACTION_BAR text: - "§aHello §b$player!" - "$delay$How are you?" - "$delay$&aBla bla bla" delaytimer: 3
Change the type to BROADCAST_ACTION_BAR, for send the message to every connected player.
- (for now the fade-out it's not configurable. I can't implement it with the current api's (without using nms)).
BLOCK_PATTERN command type
Basically every letter correspond to a block. Use or to change the Y level.
The command will start putting blocks at the player targetting block.
This this will create a somesort of a little house.
pattern_material contains the material block to be used. In this example X = OAK_PLANKS ecc.
Any not recognized letter is translated in AIR. In this example i used the O for the AIR cause it's much cleaner.
blockbuild2019yeah: command: /pattern type: BLOCK_PATTERN pattern_material: - X:OAK_PLANKS - G:GLASS - C:COBBLESTONE pattern: - CXXXXXXC - XOOOOOOX - XOOOOOOX - CXXOOXXC - - CXGXXGXC - XOOOOOOX - XOOOOOOX - CXXOOXXC - - CXGXXGXC - XOOOOOOX - XOOOOOOX - CXXGGXXC - - CCCCCCCC - COOOOOOC - COOOOOOC - CCCCCCCC - - OOOOOOOO - OXXXXXXO - OXXXXXXO - OOOOOOOO
For admins just use /mycmd undo , for players create a new command and use %PlayerOptions%undoPattern to trigger the undo effect.
mycmd-undo: command: /mycmd-undo type: RUN_COMMAND runcmd: - "%PlayerOptions%undoPattern"
You can create cooldown bar effect, on the exp bar, with this feature.
There is 2 way for do that. The first creating an simple command , with the command type EXP_BAR :
exp_bar_example: command: /expbar type: EXP_BAR delaytimer: 10
The second way, is using this placeholder "$ExpBar%10%" in the runcmd fields.
your_command: command: /123 type: RUN_COMMAND runcmd: - "$ExpBar%10%" - "$delay$<200>" - "/do something"
The OVERLAY command field
This function allow you to execute "commands" or just show text, using mycommand as an overlay.
Example, you have another plugin command, like "/gamemode", but, you want add something more to this command, like an TEXT explanation, you can do this using the "overlay" command field.
For activate this function, just put "overlay" on "true", see the example :
gamemode_overlay: command: /gamemode type: TEXT text: - "This message get showed in chat before the execution of /gamemode." - "Write your information here, bla bla bla..." overlay: true
Of course, you can use any of the MyCommand type. RUN_COMMAND, SCOREBOARD ecc.
Run a command in a specific event.
Enabling the EXTRA_LISTENER in the config.yml, you can run commands in some specific events. Avalaible events :
PlayerJoin PlayerQuit PlayerKick PlayerRespawn PlayerDeath
You can manage this events, by editing the file playerevents.yml.
Example of use :
PlayerJoin: active: true execute: - '$text$&aWelcome back &b$player !' - '$text$&6Online players : $online'
In this case, when a player join in the server, will be notified with this 2 messages.
Another example with the PlayerDeath event:
PlayerDeath: active_on_kill: true active_on_death: true ignore_env_or_mobs_deathcause: false #Prevent the player from execute command when get killed from enviroment or mobs prevent_suicide: true #Prevent the player from execute command by killing themselfs. execute_for_killer: - '/givepoints' execute_for_defeated: - '/removepoints'
You can execute commands when a player die or kill someone.
- Killer = Player who kill the victim.
- Defeated= Player who get killed from the killer.
For not allow players to not use the command (like in the example) "/givepoint", you can block that with the "execute_mode: EVENT_ONLY" line.
give_points: command: /givepoints type: RUN_COMMAND runcmd: - "$text$&aGood job! You earned one point." - "$Script$%PlayerData%points+1" - "$text$&aPoints balance : $PlayerData%points%" execute_mode: EVENT_ONLY
This feature support some special placeholder, and you can pass this variables via $args :
This variables are : $killer $killed_player and $death_cause
#MyCommand/playerevents.yml PlayerDeath: active_on_kill: true prevent_suicide: true execute_for_killer: - '$broadcasttext$ $killer killed $killed_player!' - '/commandname $killed_player' #MyCommand/commands/file.yml command_name: command: /commandname type: RUN_COMMAND runcmd: - "$Script$%if%$arg1==AdminName" - "$text$ You killed an Admin!" - "/givesomething" execute_mode: EVENT_ONLY
PlayerInteractEvent: active: true cancel_event: true materials: CHEST: - $broadcasttext$&a$player &2touched a chest! COBBLESTONE: - /say yeah
And this last one, will trigger on every player interaction.
cancel_event on false will allow players to execute the command and still open the chest or whatever interaction they are doing on the target block.
$PERFORM_COMMAND$ .Placing it before the command you need to run (like in quit or kick event) to perform only a registered command. (This function is for compatibility with VentureChat and similar)
Create command with custom prefix (not only the slash)
Using MyCommand 5.3.3 or newer, you can able to turn on this feature. Go in the config.yml and active the CHAT_LISTENER. (CHAT_LISTENER: true)
Once you have done this, restart the plugin (/reload or server restart).
Now, you can create command who don't start necessarily with the slash prefix (/).
customprefix_example: command: !example type: TEXT text: - "Command Text"
- Command without the "/", works only in the game chat, and can't be registered (register: true)
- You can use every char as a prefix : "command: !dice" "command: command" "command: $hello" ecc...
How to use Scripts, "PlayerData", "PlayerOptions" and other related feature in a RUN_COMMAND Type.
This allow you to use %if%, %else% condition, manage playerdatas and other things.