Skip to content

Add configurable custom vault cooldowns#5

Merged
minacle merged 4 commits intomainfrom
issues/4
Jan 6, 2026
Merged

Add configurable custom vault cooldowns#5
minacle merged 4 commits intomainfrom
issues/4

Conversation

@minacle
Copy link
Copy Markdown
Owner

@minacle minacle commented Jan 5, 2026

Resolves #4.

- Add `Configuration` class and `config.yml` for managing custom vault cooldown delays.
- Introduce utility methods for storing and retrieving `UUID`-based data in persistent data containers.
- Register new `NamespacedKey` constants for tracking vault cooldowns and unlocking players.
- Refactor vault scanning and processing to leverage Paper schedulers for improved performance.
- Implement core cooldown logic to track players and remove them from vanilla rewards upon expiry.
- Handle `VaultChangeStateEvent` to accurately manage player cooldown states during vault interactions.
- Update plugin lifecycle to load default configuration and manage tasks effectively.

Rationale: This change provides server administrators with granular control over vault cooldowns, allowing custom delay durations for normal and ominous vaults. It ensures players cannot immediately re-claim rewards, thereby balancing gameplay and enhancing the plugin's utility.
@minacle minacle self-assigned this Jan 5, 2026
@minacle minacle added the enhancement New feature or request label Jan 5, 2026
@minacle minacle requested a review from Copilot January 5, 2026 22:22

This comment was marked as resolved.

- Make `Configuration.Section` a static nested class for better encapsulation.
- Ensure vault delay configurations are always non-negative.
- Improve deserialisation robustness for cooldown and rewarded maps.
- Clear `blockListPool` at the start of `scanBlocksForVaults`.
- Clear internal caches after `despawnAllVaults` to prevent memory leaks.
- Correct `onVaultChangeState` visibility to `public` for proper event handling.

Rationale: These adjustments enhance the plugin's resilience to invalid configurations and corrupted data, optimise resource management, and ensure correct event processing, addressing points raised during a pull request review.

This comment was marked as resolved.

- Removed redundant `else` from an `else if` statement.
- Changed `else if (condition)` to `if (condition)` following an early `return`.
- Clarifies distinct, sequential guard clauses for improved readability.

Rationale: To enhance code clarity by explicitly showing two independent guard clauses. The `else` keyword was redundant, as the preceding `if` block always returned early, making the subsequent `if` evaluate unconditionally.

This comment was marked as resolved.

- Make `fileConfiguration` and `delay` fields in `Configuration` final.
- Remove `ThreadLocal` object pools for `HashMap` and `ArrayList`.
- Simplify block collection in `onPlayerMove` by using direct instantiation.
- Add null check for `event.getPlayer()` in `onVaultStateChange`.
- Clarify `config.yml` comments regarding vault reset delay behaviour.

Rationale: Address PR review comments by simplifying object management for improved code clarity and maintainability, while also enhancing robustness with immutability and defensive null checks.

This comment was marked as resolved.

@minacle minacle merged commit e8592f1 into main Jan 6, 2026
6 checks passed
@minacle minacle deleted the issues/4 branch January 6, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ajouter un système de personnalisation de temps avant la réutilisation possible du vault

2 participants