Best Practices

Guidelines for creating effective and maintainable commands with Command Maker.

Naming Conventions

Alias Names

Variable Names

GOOD:
${server_name}
${player_count}
${spawn_coordinates}

AVOID:
${s}
${pcount}
${SpawnCoords}

Syntax Pattern Names

{
  "teleport_player": {
    "pattern": "/tp <player>",
    "description": "Teleport to a player"
  },
  "ban_with_reason": {
    "pattern": "/ban <player> <reason>",
    "description": "Ban a player with reason"
  }
}

Organization

Group Related Aliases

In your aliases.json, organize by category:

{
  // === TELEPORT COMMANDS ===
  "spawn": "tp ${player} 0 65 0",
  "home": "tp ${player} ${home_coords}",
  "arena": "tp ${player} ${arena_coords}",
  
  // === PLAYER COMMANDS ===
  "heal": "effect give @s instant_health 1",
  "feed": "effect give @s saturation 1",
  
  // === ADMIN COMMANDS ===
  "announce": "say [ANNOUNCEMENT] ",
  "shutdown": "say Server shutting down..."
}

Comment Your Config

// Spawn and home teleport system
"spawn": "tp ${player} 0 65 0",
"home": "tp ${player} ${home_coords}",

// Healing items
"heal": "effect give @s instant_health 1",

JSON Configuration Quality

Valid JSON

JSON Formatting

// CORRECT:
{
  "key": "value",
  "nested": {
    "inner": "data"
  }
}

// WRONG:
{
  key: value,
  nested: { inner: data }
}

File Encoding

Security & Permissions

Restrict Dangerous Commands

// Only give admin permissions to these
/addcommand add ban ban-ip ${ban_player}
/addcommand add stop stop
/addcommand add pardon pardon ${player}

Use Operator Permission Checks

{
  "admin_command": "execute if entity @s[gamemode=creative] run say Admin mode active"
}

Validate Input

Be careful with user-provided parameters:

{
  "safe_tp": "execute in overworld run tp ${player} ${tp_player}"
}

Usability

Clear Feedback

Always tell users the command worked:

GOOD: 
"spawn": "tp ${player} 0 65 0 && say Teleported to spawn!"

AVOID:
"spawn": "tp ${player} 0 65 0"

Help Text

Create a help command:

/addcommand add help say Available commands: /spawn /home /arena /heal
/addcommand add help_admin say Admin: /ban /kick /stop /announce

Error Handling

Use || for fallback commands:

{
  "teleport_safe": "execute at ${tp_player} run tp ${player} @s || say Player not found"
}

Command Design

Keep Commands Simple

Good: One clear purpose

/heal - Heals the player
/feed - Feeds the player
/speed 2 - Sets speed level

Avoid: Too many features in one alias

// DON'T do this:
"do_everything": "kill @e && give @a diamond && ban @a && tp @a 0 0 0"

Consistency

Testing

Test each command before deployment:

  1. Create simple test: /addcommand add test say Works
  2. Run /test to verify
  3. Run /addcommand reload
  4. Test all aliases after reload
  5. Test with different users if possible

Performance

Avoid Heavy Selector Usage

GOOD:
"broadcast": "say ${message}" (targeted)

AVOID:
"broadcast": "say @a ${message}" (affects all players each time)

Limit Particle Effects

GOOD: 5-10 particles per command
"warp": "particle end_rod ~ ~ ~ 0.5 0.5 0.5 0.1 5 && tp ${player} 1000 100 1000"

AVOID: 100+ particles
"warp": "particle end_rod ~ ~ ~ 1 1 1 0.5 100 && tp ${player} 1000 100 1000"

Chain vs Schedule

// Immediate execution:
"fast_cmd": "say 1 && say 2 && say 3"

// Delayed execution:
"delayed_cmd": "say Starting && schedule function my_ns:delayed_tasks 60t"

Maintenance

Backup Configuration

Documentation

Document your custom syntax patterns:

// TPA System - Allows players to request teleportation
// Usage: /tpa 
// The target player receives a message with /tpaccept and /tpadeny commands
"tpa": {
  "pattern": "/tpa <player>",
  "description": "Send teleport request to another player"
}

Version Control

If using version control:

.gitignore:
config/CommandMaker/variables.json
config/CommandMaker/*.tmp

Common Mistakes to Avoid

Mistake Problem Solution
${Player} vs ${player} Case sensitivity error Always use lowercase
Trailing commas in JSON JSON parse error Remove last comma in objects
Single quotes in JSON Invalid JSON Use double quotes only
Forgetting to reload Changes don't apply Run /addcommand reload
Too complex commands Hard to debug/maintain Split into multiple aliases
No feedback messages Confusing for users Add say feedback

Server Administration

Moderation Commands

User Experience

Public vs Private

Use operator permission checks:

{
  "admin_say": "execute if entity @s[gamemode=creative] run say ${message} || say No permission"
}

✨ Summary

Follow these practices for maintainable, user-friendly commands:

  • ✓ Use clear naming conventions
  • ✓ Keep commands simple and focused
  • ✓ Provide user feedback
  • ✓ Test thoroughly
  • ✓ Document your work
  • ✓ Backup configurations
  • ✓ Prioritize security