xCommands icon

xCommands -----

Create custom commands with great versatility and JSON support !



Hiya, this is a small list of the features and how to use them !

/xc help
» Shows a list of commands​
/xc reload
» Reloads all of your commands and config settings​
/xc list
» Shows a list of your custom commands
» Green = enabled, Red = disabled​
/xc enable <command>
» Enables a command to allow use​
/xc disable <command>
» Disabled a command to prevent use​
/xc run <player> <command>
» Runs a custom command for a player (don't include /)
» This commands allows subcommands
» example: /xc run xWil socials twitch​

messageNoPermisions
» The message sent when the player doesn't have permission to use any command​
messageCommandNotEnabled
» The message sent when someone attempts to run a command that's disabled​
messageWorldNotInWhitelist
» The message sent when someone attempts to run a command in a world that isn't within the whitelist​
messageWorldInBlacklist
» The message sent when someone attempts to run a command in a world that's within the blacklist​
messageCommandOnCooldown
» The message sent when the command they attempt to run a command that's on cooldown
» Use {0} in the message to display the number of seconds remaining​
messageCommandOnGlobalCooldown
» The message sent when someone attempts to run a command thats on global cooldown
» Use {0} in the message to display the number of seconds remaining​

Full default config:
Code (YAML):
# Messages
messageNoPermissions
: "&8&l» &cYou don't have permission to use that command."
messageCommandNotEnabled
: "&8&l» &cThat command is not enabled."
# Use {0} to display the time left (in seconds)
messageCommandOnCooldown
: "&8&l» &cThe command is on cooldown for another &e{0}s&c."
messageCommandOnGlobalCooldown
: "&8&l» &cThe command is on cooldown for another &e{0}s&c."
messageWorldNotInWhitelist
: "&8&l» &cThat command is now available in this world."
messageWorldInBlacklist
: "&8&l» &cThat command is now available in this world."

All of these sections now pertain to making custom commands:

Step 1:
To make a new command, you first need to find the commands folder within the plugin folder. If it's not there, reload the plugin and it should create it along with an example command.

Step 2:
In the commands folder, create a new file and make sure it has a .yml file extension. This can be named anything and won't be seen anywhere in the plugin.

Step 3:
This is one of the most important steps, there are a few required settings for your command that go at the top of the file. See the settings section to see a fully detailed description of what all these settings do. I'd recommend copying from the examplecmd.yml file, or from below:
Code (YAML):
enabled : true
name
: 'diamond'
json
: false
permission
: ' none'

# 1000 = 1 second
globalCooldown
: 0
cooldown
: 3000

worldWhiteList
: [ ]
worldBlackList
: [ ]
Step 4:
The penultimate step to making your command is setting up the commands functionality! This is all done within the subcommands block. The main component of a subcommand is the default block, this block contains all the functionality each subcommand will do. Inside the default block there's the text list, command list and conditions block.
The text list is the messages sent to the player, command list are the commands ran when the command is executed (don't include the / ). [player] can be placed at the start of the command to have it ran by the player. %player% is replaced with the player name. To see how the conditions are used, please see the conditions section.
Here's an example subcommands section, this will send the player the phrase 'have a diamond', and give them a diamond:
Code (YAML):
subcommands:
  default
:
    # all of the default functionality of your command - /<name>
    text
:
     - 'have a diamond'
    commands
:
     - ' give %player% diamond 1'
    conditions
: [ ]
Step 5:
Adding subcommands. It gets a little more complicated now but it still has the same process. All you have to do is add another block inside your subcommands block with the title of whatever you want your subcommand to be. Inside of that you need to add another default block and it should work !
Here's the previous example but I've added the subcommand /<name> double, which gives 2 diamonds instead of 1.
Code (YAML):
subcommands:
  default
:
    # all of the default functionality of your command - /<name>
    text
:
     - 'have a diamond'
    commands
:
     - ' give %player% diamond 1'
    conditions
: [ ]
 
  double
:
    default
:
      # this will run if the player types the command /<name> double
      text
:
       - 'have 2 diamonds'
      commands
:
       - ' give %player% diamond 2'
      conditions
: [ ]
These subcommands can go infinitely deep ! As many as you want, here's another example with multiple subcommands:
Code (YAML):
subcommands:
  default
:
    # all of the default functionality of your command - /<name>
    text
:
     - 'have a diamond'
    commands
:
     - ' give %player% diamond 1'
    conditions
: [ ]
 
  double
:
    default
:
      # this will run if the player types the command /<name> double
      text
:
       - 'have 2 diamonds'
      commands
:
       - ' give %player% diamond 2'
      conditions
: [ ]
 
    again
:
      default
:
        # this will run if the player types the command /<name> double again
        text
:
         - 'have 4 diamonds'
        commands
:
         - ' give %player% diamond 4'
        conditions
: [ ]
     
  triple
:
    default
:
      # this will run if the player types the command /<name> triple
      text
:
       - 'have 3 diamonds'
      commands
:
       - ' give %player% diamond 3'
      conditions
: [ ]
And finally, here's the finished command file with all of the settings:
Code (YAML):
enabled : true
name
: 'diamond'
json
: false
permission
: ' none'

globalCooldown
: 0
cooldown
: 0

worldWhiteList
: [ ]
worldBlackList
: [ ]

subcommands
:
  default
:
    # all of the default functionality of your command - /<name>
    text
:
     - 'have a diamond'
    commands
:
     - ' give %player% diamond 1'
    conditions
: [ ]
 
  double
:
    default
:
      # this will run if the player types the command /<name> double
      text
:
       - 'have 2 diamonds'
      commands
:
       - ' give %player% diamond 2'
      conditions
: [ ]
 
    again
:
      default
:
        # this will run if the player types the command /<name> double again
        text
:
         - 'have 4 diamonds'
        commands
:
         - ' give %player% diamond 4'
        conditions
: [ ]
     
  triple
:
    default
:
      # this will run if the player types the command /<name> triple
      text
:
       - 'have 3 diamonds'
      commands
:
       - ' give %player% diamond 3'
      conditions
: [ ]

There are 10 total conditions and you can use any number of them on every subcommand !
Every condition will have both a value field and a failureMessage field. The value field is the amount, so for cooldown, its the duration of the cooldown. The failureMessage field is the message sent to the player when the condition is not met.

Some conditions have a deduct field, which can be true or false. For example, health, if deduct is true, it will take away the players health.

cooldown
» The value field of cooldown is a number, and is the duration of the cooldown in ms.
» In the failure message, use {0} to display the time left in seconds.​
Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      cooldown
:
        value
: 3000
        failureMessage
: 'You have {0 }s left of cooldown.'
cost
» Requires Vault
» The value field in cost is a number, and is the amount of money the player need to use the command.
» Set deduct to true if you want the player to spend that money.​
Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      cost
:
        value
: 10
        deduct
: true
        failureMessage
: 'You need 10$ to use this command.'
health
» The value field in cost is a number, and is the amount of health the player needs.
» 1 Health = half a heart
» Set deduct to true if you want the player to lose the health.​

Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      health
:
        value
: 10 #5 hearts
        deduct
: true
        failureMessage
: 'You need 5 hearts to use this command.'
hunger
» The value field in cost is a number, and is the amount of hunger the player needs.
» 1 Hunger = half a bar
» Set deduct to true if you want the player to lose the hunger.​
Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      hunger
:
        value
: 10 #5 bars
        deduct
: true
        failureMessage
: 'You need 5 hunger bars to use this command.'
inGroup
» Requires Vault
» The value field in inGroup is a string, and is the name of a group the player is in.
» This checks if the player is in this group.​
Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      inGroup
:
        value
: 'moderator'
        failureMessage
: 'You dont have permission to use this command.'
isOp
» The value field is a boolean, so true or false.
» Checks if the player is an operator on the server.​

Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      isOp
:
        value
: true
        failureMessage
: 'You are not an operator!'
papi
» Requires PlaceholderAPI
» The papi condition has it's own special field requirement called 'papi'. This field related to the placeholder to check against.
» The value field is a string and should be the wanted response when the placeholder is replaced.
» Any placeholder works as long as you have the correct expansions downloaded.​
Code (YAML):
conditions:
      papi
:
       papi
: ' %player_allow_flight%'
       value
: ' yes'
       failureMessage
: 'You need to be flying to use this command.'

permission
» The value field is a string and can be any permission node.
» Checks if the player has this permission.​
Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      permission
:
       value
: 'some.permission.node'
       failureMessage
: 'You dont have permission to do this.'
 
xp
» The value field is an integer and is an amount of xp the player needs.
» Set deduct to true if you want the player to lose the xp.​
Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      xp
:
       value
: 5
       deduct
: true
       failureMessage
: 'You dont have enough xp to do this.'
xpLevel
» The value field is an integer and is the number of levels the player needs.
» Set deduct to true if you want the player to lose the levels.​
Code (YAML):
subcommands:
  default
:
    text
:
   - 'Have a diamond'
    commands
:
   - 'give %player% diamond 1'
    conditions
:
      xpLevel
:
       value
: 5
       deduct
: true
       failureMessage
: 'You dont have enough levels to do this.'

work in progress, more details to be added soon :)
Resource Information
Author:
----------
Total Downloads: 251
First Release: Oct 22, 2023
Last Update: Jan 13, 2024
Category: ---------------
All-Time Rating:
4 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings