Skip to content

Skript Style Guide

To maintain consistency across the Kaizen Network codebase, please adhere to the following Skript coding standards. These patterns are derived from the existing codebase.

Naming Conventions

Variables

  • Persistent Player Data: {playerdata::%uuid%::key}
    • Example: {playerdata::%player's uuid%::honor}
  • System Configuration: {system::module::key}
    • Example: {system::planet::tier1::hoe::*}
  • Temporary/Cache: {-temp::module::key} or {temp::module::key}
    • Example: {-temp::planetloop::%player%}
  • Global Economy: {economy::%type%::...}

Functions

Use camelCase for function names.

function checkCompletedDM(p: player, r: player) :: integer:
    # ...

Options

Use options at the top of the file for configuration (Prefixes, Colors, Constants).

options:
    prefix: " <#fb3131>H<#fc3f30>o<#fc4d2f>n<#fd5b2e>o<#fd692d>r &8|&r"
    max_level: 50

Item Identification

Do not rely on display names or lore for item identification. Use NBT tags.

Standard Pattern

  • Tag: custom;id or specialized tags like custom;hcp (Energy Producer).
  • Checking:
    if int tag "custom;id" of nbt of tool is 100:
        # Is item 100
    

Performance Tips

  1. Async Sections: Use create new section stored in {_async} for heavy calculations (database, large loops) where possible (requires Skript-Reflect/Addon support).
    create new section stored in {_async}:
         # Heavy math
    run section {_async} async
    
  2. Looping: Avoid looping all players. Use specific lists if possible.
  3. Cooldowns: Use metadata tags or temporary variables for short cooldowns.
    set metadata tag "cd" of player to now
    if time since (metadata tag "cd" of player) < 1 second:
        stop
    

File Structure

  1. Options: Configuration.
  2. Variables/Load: on script load handlers.
  3. Commands: User-facing commands.
  4. Functions: Helper logic.
  5. Events: Game listeners.