# CelestCombat-Pro v1.2.0 — Major Performance Optimization Update
## Overview
This update introduces major performance improvements to the WorldGuard safe-zone protection system and fixes issues with combat command blocking.
The focus of this release is **reducing CPU usage during player movement and combat interactions**, making the plugin significantly more efficient on servers with many players.
Expected performance improvement: **up to 90% reduction in CPU usage for safezone barrier detection.**
---
## Performance Improvements
### WorldGuard Safezone Barrier Optimization
The safezone detection and barrier visualization system has been heavily optimized.
**Estimated CPU usage improvement**
Before
~1.60% server thread usage
After
~0.15–0.20% server thread usage
These improvements are most noticeable on PvP servers with many players in combat near protected regions.
---
### Reduced Vertical Scanning
Barrier detection previously scanned a large vertical range.
The scan height is now limited to **4 blocks relative to the player**.
Benefits:
* Reduces location checks significantly
* Improves safezone border detection performance
* Lowers CPU usage during movement events
---
### Barrier Update Early Exit
Barrier updates now stop immediately if the barrier layout has not changed.
This prevents unnecessary operations such as:
* recalculating barrier locations
* sending redundant block updates
* iterating over barrier collections
---
### Location Object Reuse
Location objects are now reused during scanning instead of creating new instances.
Previously each update could create **hundreds of Location objects**.
This change removes a major source of memory allocation and reduces garbage collection pressure.
---
### Optimized HashSet Usage
Barrier tracking collections have been optimized to avoid unnecessary HashSet creation.
Collections are now created only when required.
---
### Packed Cache Keys
Safezone caching now uses **bit-packed long keys** instead of string concatenation.
Previous cache format:
`world:x:y:z`
New cache format:
`long packedLocationKey`
Benefits:
* eliminates string allocations
* improves map lookup speed
* significantly reduces memory overhead
---
## Bug Fixes
### Combat Command Blocking
Commands defined in the combat blacklist were not always blocked due to case-sensitive comparisons.
Command matching is now **fully case-insensitive**.
Example commands that are now correctly blocked:
* `/tpa`
* `/TPA`
* `/Tpa`
* `/spawn`
* `/SPAWN`
Wildcard patterns continue to function as expected.
Example configuration:
```
blocked_commands:
- tpa
- spawn
- team*
```
---
## Technical Improvements
### Object Allocation Reduction
The update removes hundreds of unnecessary object allocations during player movement events.
Key improvements include:
* removing Location cloning inside loops
* eliminating string-based cache keys
* optimizing HashSet usage
* reducing safezone scanning volume
---
## Expected Server Impact
Example scenario: **50 players moving in combat near safezones**
Before update
~1.60% CPU usage
After update
~0.15–0.20% CPU usage
This results in smoother gameplay and reduced server load during PvP.
---
## Recommendation
This update is strongly recommended for servers running practice PvP, combat-focused gameplay, or large player counts.
Updating will significantly improve movement handling and safezone barrier performance.
Developer information
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle.
maven { name = "Modrinth"; url = "https://api.modrinth.com/maven" }