Skip to content

Add Runtime Feature Flag System to FoliaCore with Enable/Disable Commands #41

Description

@GoodrichDev

Feature Description

Implement a dynamic feature flag system within the FoliaCore plugin that supports in-game enabling and disabling of specific features without requiring a server restart. The system should include commands like /foliacore enable <feature> and /foliacore disable <feature>, as well as a /foliacore reload to reload configuration changes. Each listener or feature module, such as DoggySteakListener, will check the flag status before executing logic—skipping or cancelling behavior if the feature is disabled.

Why This Feature Should Be Added

This system would make managing and testing features significantly more efficient. Server administrators would gain real-time control over specific functionalities, allowing quick hotfixes, testing, and feature rollouts without interrupting gameplay. It would also help in debugging and isolating problem areas by disabling individual components safely during runtime.

Potential Implementation Details

  • Create a central FeatureFlagManager in FoliaCore that loads flags from a YAML or JSON config.
  • Provide getter methods like isFeatureEnabled("doggy-steak") for use in listeners.
  • Add commands:
    • /foliacore enable <flag>
    • /foliacore disable <flag>
    • /foliacore reload to re-read the config and apply changes.
  • In listeners like DoggySteakListener, check the flag before proceeding:
    if (!FeatureFlagManager.isEnabled("doggy-steak")) {
        event.setCancelled(true);
        return;
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    • Status
      Feature

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions