Examples
Examples
Section titled “Examples”This page provides practical examples of how to use the Custom Commands plugin. These examples range from basic setups to advanced configurations.
Basic Examples
Section titled “Basic Examples”Simple Welcome Command
Section titled “Simple Welcome Command”A basic command that welcomes players to your server.
commands: welcome: permission: "customcommands.welcome" alias: ["hi", "hello"] description: "Welcome message" enabled: true cooldown: 0 message: - "&6&l=== Welcome ===" - "&eWelcome to our server, &a{player}&e!" - "&7Use &e/help &7for available commands" - "&7Join our Discord: (Click here)[<https://discord.gg/2qCMn6KHj4>]"Server Information Command
Section titled “Server Information Command”Display server information and statistics.
commands: info: permission: "customcommands.info" alias: ["serverinfo", "server"] description: "Server information" enabled: true cooldown: 5 message: - "&6&l=== Server Information ===" - "&7Online Players: &a{online_players}&7/&a{max_players}" - "&7Your World: &b{world}" - "&7Your Location: &e{x}, {y}, {z}" - "&7Server: &dMinecraft 1.21" - "&7Website: (Visit)[<https://example.com>]"Rules Command
Section titled “Rules Command”Display server rules with proper formatting.
commands: rules: permission: "customcommands.rules" alias: ["rule", "serverrules"] description: "Show server rules" enabled: true cooldown: 10 message: - "&c&l=== Server Rules ===" - "&71. &eBe respectful to other players" - "&72. &eNo griefing or stealing" - "&73. &eNo cheating or hacking" - "&74. &eFollow staff instructions" - "&75. &eNo spamming or advertising" - "&76. &eUse appropriate language" - "&77. &eHave fun and enjoy the server!" - "&7" - "&cBreaking these rules may result in a ban!"Advanced Examples
Section titled “Advanced Examples”Discord Command with Subcommands
Section titled “Discord Command with Subcommands”A comprehensive Discord command with multiple subcommands.
commands: discord: permission: "customcommands.discord" alias: ["dc", "discordserver"] description: "Discord server information" enabled: true cooldown: 0 subcommands: join: permission: "customcommands.discord.join" message: - "&6&l=== Join Discord ===" - "&eClick the link below to join our Discord:" - "&7(Discord Server)[<https://discord.gg/2qCMn6KHj4>]" - "&7" - "&7Benefits of joining:" - "&7• &aGet support and help" - "&7• &aStay updated with news" - "&7• &aConnect with other players"
invite: permission: "customcommands.discord.invite" message: - "&6&l=== Discord Invite ===" - "&eHere's your Discord invite:" - "&7(Join Discord)[<https://discord.gg/2qCMn6KHj4>]" commands: - "tellraw {player} [\"\",{\"text\":\"Discord Invite: \",\"color\":\"gold\"},{\"text\":\"https://discord.gg/2qCMn6KHj4\",\"color\":\"aqua\",\"underlined\":true,\"clickEvent\":{\"action\":\"open_url\",\"value\":\"https://discord.gg/2qCMn6KHj4\"}}]"
help: permission: "customcommands.discord.help" message: - "&6&l=== Discord Help ===" - "&eAvailable commands:" - "&7/discord - Show Discord information" - "&7/discord join - Join our Discord" - "&7/discord invite - Get invite link" - "&7/discord help - Show this help"
message: - "&6&l=== Discord ===" - "&eJoin our Discord server!" - "&7Click here: (Discord)[<https://discord.gg/2qCMn6KHj4>]" - "&7Use &e/discord help &7for more options"Shop Command with Console Execution
Section titled “Shop Command with Console Execution”A shop command that executes commands for economy integration.
commands: shop: permission: "customcommands.shop" alias: ["store", "buy"] description: "Open the shop" enabled: true cooldown: 3 commands: - "tellraw {player} [\"\",{\"text\":\"Opening shop...\",\"color\":\"green\"}]" - "execute as {player} run say I want to buy something!" - "title {player} title [\"\",{\"text\":\"Shop\",\"color\":\"gold\"}]" - "title {player} subtitle [\"\",{\"text\":\"Welcome to our shop!\",\"color\":\"gray\"}]" message: - "&6&l=== Shop ===" - "&eOpening the shop for you..." - "&7Check your chat for shop options!" - "&7Website: (Online Shop)[<https://shop.example.com>]"Teleport Command
Section titled “Teleport Command”A teleport command with location-based console execution.
commands: spawn: permission: "customcommands.spawn" alias: ["hub", "lobby"] description: "Teleport to spawn" enabled: true cooldown: 5 commands: - "teleport {player} 0 64 0" - "effect give {player} minecraft:instant_health 1 1 true" - "tellraw {player} [\"\",{\"text\":\"Welcome to spawn!\",\"color\":\"green\"}]" message: - "&a&l=== Spawn ===" - "&eTeleporting you to spawn..." - "&7You have been healed!"Staff Command
Section titled “Staff Command”A staff-only command with administrative functions.
commands: staff: permission: "customcommands.staff" alias: ["admin", "mod"] description: "Staff information" enabled: true cooldown: 0 subcommands: online: permission: "customcommands.staff.online" message: - "&6&l=== Online Staff ===" - "&eCurrently online staff members:" - "&7• &aAdmin1 &7- Available for help" - "&7• &aModerator1 &7- Busy" - "&7• &aModerator2 &7- Available" commands: - "tellraw @a [\"\",{\"text\":\"Staff member \",\"color\":\"yellow\"},{\"text\":\"{player}\",\"color\":\"green\"},{\"text\":\" checked online staff\",\"color\":\"yellow\"}]"
help: permission: "customcommands.staff.help" message: - "&6&l=== Staff Help ===" - "&eAvailable staff commands:" - "&7/staff online - Show online staff" - "&7/staff help - Show this help" - "&7/staff tools - Get staff tools"
tools: permission: "customcommands.staff.tools" message: - "&6&l=== Staff Tools ===" - "&eGiving you staff tools..." commands: - "give {player} minecraft:stick{display:{Name:'[{\"text\":\"Staff Stick\",\"color\":\"gold\"}]'}}" - "give {player} minecraft:compass{display:{Name:'[{\"text\":\"Teleport Tool\",\"color\":\"aqua\"}]'}}" - "tellraw {player} [\"\",{\"text\":\"Staff tools given!\",\"color\":\"green\"}]"
message: - "&6&l=== Staff ===" - "&eStaff command system" - "&7Use &e/staff help &7for available commands"Creative Examples
Section titled “Creative Examples”Fun Commands
Section titled “Fun Commands”Commands that add fun and entertainment to your server.
Magic Command
Section titled “Magic Command”commands: magic: permission: "customcommands.magic" alias: ["spell", "cast"] description: "Cast a magic spell" enabled: true cooldown: 10 commands: - "effect give {player} minecraft:levitation 5 1 true" - "effect give {player} minecraft:glowing 10 1 true" - "particle minecraft:enchant ~ ~ ~ 1 1 1 0.1 50" - "playsound minecraft:entity.enderman.teleport player {player} ~ ~ ~ 1 1" message: - "&d&l=== Magic Spell ===" - "&eCasting magic spell on &a{player}&e!" - "&7You are now floating and glowing!" - "&7The spell will last for 5 seconds!"Dance Command
Section titled “Dance Command”commands: dance: permission: "customcommands.dance" alias: ["boogie", "party"] description: "Start dancing" enabled: true cooldown: 5 commands: - "effect give {player} minecraft:speed 10 2 true" - "effect give {player} minecraft:jump_boost 10 2 true" - "title {player} title [\"\",{\"text\":\"Dancing!\",\"color\":\"gold\"}]" - "playsound minecraft:music.disc.11 player {player} ~ ~ ~ 1 1" message: - "&6&l=== Dance Party ===" - "&eLet's dance, &a{player}&e!" - "&7You have speed and jump boost!" - "&7Dance for 10 seconds!"Informational Commands
Section titled “Informational Commands”Commands that provide useful information to players.
Server Status Command
Section titled “Server Status Command”commands: status: permission: "customcommands.status" alias: ["serverstatus", "ping"] description: "Check server status" enabled: true cooldown: 3 message: - "&6&l=== Server Status ===" - "&7Server: &aOnline" - "&7Players: &a{online_players}&7/&a{max_players}" - "&7Your World: &b{world}" - "&7Your Location: &e{x}, {y}, {z}" - "&7Uptime: &a24/7" - "&7Website: (Check Status)[<https://status.example.com>]"Help Command
Section titled “Help Command”commands: help: permission: "customcommands.help" alias: ["commands", "cmds"] description: "Show available commands" enabled: true cooldown: 0 message: - "&6&l=== Available Commands ===" - "&7General Commands:" - "&7• &e/welcome &7- Welcome message" - "&7• &e/info &7- Server information" - "&7• &e/rules &7- Server rules" - "&7• &e/discord &7- Join our Discord" - "&7• &e/shop &7- Open the shop" - "&7• &e/spawn &7- Teleport to spawn" - "&7" - "&7Fun Commands:" - "&7• &e/magic &7- Cast a magic spell" - "&7• &e/dance &7- Start dancing" - "&7• &e/status &7- Check server status" - "&7" - "&7Need more help? Join our Discord!"Advanced Examples
Section titled “Advanced Examples”Command with Required Arguments
Section titled “Command with Required Arguments”Example of a command that requires specific arguments:
commands: ah: permission: "customcommands.ah" subcommands: sell: # /ah sell <price> [amount] permission: "customcommands.ah.sell" arguments: required-args: [0] # First argument (price) is REQUIRED no-arguments: false invalid-message: "&cUsage: /ah sell <price> [amount]" commands: - "tellraw {player} [\"\",{\"text\":\"Price: \",\"color\":\"gold\"},{\"text\":\"{arg:1}\",\"color\":\"green\"},{\"text\":\", Amount: \",\"color\":\"gold\"},{\"text\":\"{arg:2}\",\"color\":\"yellow\"}]" # {arg:1} = price (required) # {arg:2} = amount (optional, empty string if not provided)Usage:
/ah sell 100→ Valid: Price: 100, Amount: (empty)/ah sell 100 64→ Valid: Price: 100, Amount: 64/ah sell→ Invalid: Shows error message
Command Without Messages
Section titled “Command Without Messages”Example of a command that executes silently without sending messages:
commands: silent: permission: "customcommands.silent" commands: # No message field - command executes silently - "effect give {player} minecraft:invisibility 30 1 true" - "effect give {player} minecraft:night_vision 30 1 true"Configuration Tips
Section titled “Configuration Tips”Best Practices
Section titled “Best Practices”- Use Descriptive Names - Choose clear, memorable command names
- Set Appropriate Cooldowns - Prevent spam while keeping commands usable
- Use Permissions - Control access to different commands
- Test Commands - Always test commands before deploying
- Use Commands - Leverage command execution for advanced features
- Messages are Optional - Commands can execute without messages if needed
Performance Considerations
Section titled “Performance Considerations”- Limit Commands - Too many commands can impact performance
- Use Appropriate Cooldowns - Prevent command spam
- Optimize Messages - Keep messages concise but informative
- Test on Production - Test commands on a test server first
Security Considerations
Section titled “Security Considerations”- Validate Permissions - Ensure proper permission checks
- Sanitize Input - Be careful with user input in commands
- Limit Commands - Only use necessary commands
- Regular Audits - Review command configurations regularly
Next Steps
Section titled “Next Steps”Now that you’ve seen these examples:
- Try the Examples - Test these examples on your server
- Create Your Own - Use these as inspiration for your own commands
- Read the Configuration Guide - Learn more about configuration options
- Join our Discord - Share your creations and get help
For support and updates, join our Discord server.