NamelessMC Documentation

repository·develop·Indexed 20 days ago

https://github.com/namelessmc/nameless

Specialized website software for Minecraft server communities featuring forums, custom pages, and deep integration with Minecraft and Discord. Version 2.2.5 includes support for Java/Bedrock server status, account verification, rank synchronization, and a module system for extensibility. Documentation covers installation via Docker Compose, PHP 8.2+ system requirements, API usage, and development guides for creating modules, templates, and widgets.

Tokens
5K
Snippets
15
Records
25
Agent score
71%

What's inside NamelessMC

  1. Overview of NamelessMC v2 features

    develop

    NamelessMC is a website software designed for Minecraft server communities. Key features include:

    • Forums: Community discussion boards.
    • Custom Pages: Create HTML pages with group-based access restrictions.
    • Social Logins: Integration with Discord and Google.
    • Minecraft Integration:
      • Server status display (Java/Bedrock).
      • Account verification via MCAssoc or the NamelessMC plugin.
      • In-game plugin support for registration, rank synchronization (Vault to NamelessMC), announcements, whitelisting, and banning.
    • Discord Integration: Webhooks for updates and the Nameless-Link bot for bidirectional role/group synchronization.
    • Extensibility: A powerful module system, widget system, and a full API.
    • Customization: Template and language systems for total UI/UX control.
    • Pretty URLs: Supported via mod_rewrite or specific Nginx configurations.
  2. Develop NamelessMC modules

    develop

    Developers looking to extend NamelessMC can use the module system. Detailed documentation for module development is available in the official Module Developer Documentation.

    Note: Documentation for template and widget development is currently in development.

  3. Install NamelessMC

    develop

    Detailed installation instructions for NamelessMC can be found on the official wiki.

    For Minecraft server integration, you can install the Nameless Plugin, which supports the following platforms:

    • BungeeCord
    • Paper
    • Spigot
    • Sponge
    • Velocity
  4. Format forum last post data

    develop

    When displaying forum or subforum lists, you may need to enrich the last_post data object. The following properties are commonly used to display the most recent activity:

    • avatar: The avatar of the last poster (retrieved via $user->getAvatar(size)).
    • user_style: The CSS class/style associated with the poster's group.
    • username: The display name of the poster.
    • profile: The URL to the poster's profile.
    • date_friendly: A human-readable 'time ago' string (e.g., '2 hours ago') generated using the TimeAgo class.
    • post_date: The formatted date string.
  5. Enable debugging in NamelessMC

    develop

    Debugging can be enabled in two ways:

    1. Directly in index.php: Uncomment the define('DEBUGGING', 1); line.
    2. Via Environment Variables: Set the NAMELESS_DEBUGGING environment variable or the $_SERVER['NAMELESS_DEBUGGING'] server variable.

    When debugging is enabled, display_errors and display_startup_errors are set to 1 to allow visibility into PHP errors.

  6. Set up NamelessMC for development using Docker Compose

    develop

    This docker-compose.yaml file is intended for development environments only. For production deployments, use the official Nameless-Docker repository.

    Setup and Execution

    1. Create the directory: sudo mkdir /opt/namelessmc
    2. Start the services: docker compose up
    3. Update images: docker compose pull
    4. Uninstall:
      • docker compose down
      • rm -rf core/config.php cache/*
      • sudo rm -r /opt/namelessmc
      • docker image prune -af
    # Set up
    sudo mkdir /opt/namelessmc
    
    # Run
    docker compose up
  7. Access the Staff Panel entrypoint

    develop

    The Staff Panel (Admin Panel) is accessed via the modules/Core/pages/panel/index.php entrypoint. Before any content is rendered, the system performs a permission check using $user->handlePanelPageLoad(). If this returns false, the user is redirected to a 403.php error page.

    Key constants defined at this entrypoint:

    • PAGE: Set to 'panel'.
    • PANEL_PAGE: Set to 'dashboard'.

    The page lifecycle follows this sequence:

    1. Permission check via $user->handlePanelPageLoad().
    2. Initialization of backend templates via backend_init.php.
    3. Module loading via Module::loadPage().
    4. Data gathering (Dashboard graphs, News, Compatibility checks).
    5. Template variable injection.
    6. Template display via $template->displayTemplate('index').
  8. Configure IIS URL Rewriting for NamelessMC

    develop

    NamelessMC requires specific URL rewriting rules to be configured in the web.config file when running on an IIS (Internet Information Services) web server. These rules handle:

    1. Trailing Slash Redirection: Redirects requests for directories that are not actual physical directories to their non-trailing-slash equivalent (Rule 2).
    2. Avatar Routing: Rewrites clean avatar URLs (e.g., /avatar/username/size/type) to the internal core/avatar/face.php handler (Rules 3, 4, 5, and 6).
    3. Front Controller Pattern: Routes all requests that do not match an existing physical file or directory to index.php using the route query parameter (Rule 7). This enables NamelessMC's SEO-friendly routing.

    To use this configuration, rename web.config.example to web.config and place it in your web root.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <!-- Rule 2: Remove trailing slashes -->
                    <rule name="Rule 2" stopProcessing="true">
                        <match url="^(.+)/" ignoreCase="false" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        </conditions>
                        <action type="Redirect" url="{R:1}" redirectType="Permanent" />
                    </rule>
    
                    <!-- Rules 3-6: Avatar Rewriting -->
                    <!-- ... -->
    
                    <!-- Rule 7: Route everything else to index.php -->
                    <rule name="Rule 7" stopProcessing="true">
                        <match url="^(.*)$" />
                        <conditions logicalGrouping="MatchAll">
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php?route=/{R:1}" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
  9. Initialize and Display a Page

    develop

    A standard NamelessMC page entrypoint follows a specific lifecycle to ensure modules, navigation, and templates are loaded correctly:

    1. Define Page Identity: Set the PAGE constant and $page_title.
    2. Initialize Frontend: require_once ROOT_PATH . '/core/templates/frontend_init.php';.
    3. Load Modules: Use Module::loadPage() passing the $user, $pages, $cache, $smarty, navigation arrays, $widgets, and $template.
    4. Render Components: Require standard components like cc_navbar.php, navbar.php, and footer.php.
    5. Finalize: Call $template->onPageLoad() and then $template->displayTemplate('template_path').
    const PAGE = 'cc_overview';
    $page_title = $language->get('user', 'user_cp');
    require_once ROOT_PATH . '/core/templates/frontend_init.php';
    
    // ... logic ...
    
    Module::loadPage($user, $pages, $cache, $smarty, [$navigation, $cc_nav, $staffcp_nav], $widgets, $template);
    
    require(ROOT_PATH . '/core/templates/cc_navbar.php');
    $template->onPageLoad();
    require(ROOT_PATH . '/core/templates/navbar.php');
    require(ROOT_PATH . '/core/templates/footer.php');
    
    $template->displayTemplate('user/index');
  10. Reinstall NamelessMC in a Docker container

    develop

    To perform a reinstallation within the running development environment, execute the CLI install script via the php service using the --reinstall flag. Note that the script requires a specific confirmation flag to proceed.

    docker compose exec php php -f dev/scripts/cli_install.php '--' '--iSwearIKnowWhatImDoing' '--reinstall'