Skip to content

feat: add command blocker#83

Closed
purpurcof wants to merge 1 commit into
whereareiam:releasefrom
purpurcof:feature/command-blocker
Closed

feat: add command blocker#83
purpurcof wants to merge 1 commit into
whereareiam:releasefrom
purpurcof:feature/command-blocker

Conversation

@purpurcof
Copy link
Copy Markdown

@purpurcof purpurcof commented May 24, 2026

Description:
This Pull Request introduces a foundational mechanism to restrict command usage for players who have not yet completed the authentication process. A collector has been implemented to filter allowed commands and cache them to improve performance.

Key changes:

  • Added DefaultCommandDefinitionCollector: Implements command collection logic (via CommandService). This component extracts the aliases of commands that have the allowedDuringAuth flag set to true, and automatically permits the use of the "main" system command.
  • Thread-safe Caching: To avoid redundant computations during each check, a thread-safe caching mechanism for the list of allowed aliases (cachedAliases) has been implemented. An invalidateCache() method was also added to reset the cache (e.g., during a plugin reload).
  • Dependency Injection (DI): The new component is registered in the CommandConfiguration module using Guice (asEagerSingleton).
  • Testing: Added unit tests (DefaultCommandDefinitionCollectorTest) using JUnit 5 and Mockito to verify the correct filtering of aliases and the overall functionality of the collector.

Tested environment:

  • Successfully tested on Velocity alongside CommandWhitelist and LuckPerms.

@whereareiam
Copy link
Copy Markdown
Owner

Hi, and first of all, thank you for your pull request.

I would not merge this pull request in its current form, as command blocking is not a core responsibility of an identity plugin. It feels like a separate concern that should be handled through a dedicated mechanism.

My suggestion would be to implement this as an add-on plugin within this repository. Alternatively, you could maintain it as a separate resource, which we can then reference or add to the documentation.

@whereareiam
Copy link
Copy Markdown
Owner

Was implemented as a separate addon plugin here:
https://github.com/purpurcof/Identica-Commandblocker

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants