Compatibility
Minecraft: Java Edition
Platforms
Links
Tags
Creators
Details
**## Overview
CombatMetrics is a lightweight, high-performance combat tracking plugin for Paper 1.21+ servers. It accurately detects and displays Critical Hits and Sprint Combo Hits in real-time using the player's Action Bar. The plugin faithfully replicates vanilla Minecraft's exact combat mechanics, ensuring that every tracked hit matches what would trigger the corresponding subtitle/particle effect in the base game.
Core Concept
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā COMBATMETRICS FLOW ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā PLAYER ATTACKS ENTITY ā
ā ā ā
ā ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāā ā
ā ā Check Critical ā ā Check Combo ā ā
ā ā Hit Conditions ā ā Hit Conditions ā ā
ā ā (11 Checks) ā ā (3 Checks) ā ā
ā āāāāāāāāāāā¬āāāāāāāāāāā āāāāāāāāāāā¬āāāāāāāāāāā ā
ā ā ā ā
ā ā¼ ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāā ā
ā ā Increment Crit ā ā Increment Combo ā ā
ā ā Counter ā ā Counter ā ā
ā āāāāāāāāāāā¬āāāāāāāāāāā āāāāāāāāāāā¬āāāāāāāāāāā ā
ā ā ā ā
ā āāāāāāāāāāāāā¬āāāāāāāāāāāāāāāā ā
ā ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā UPDATE ACTION BAR ā ā
ā ā [ ā CRITS: X | ā COMBO: Y ] ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā
ā ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā No hit for 2 seconds? ā ā
ā ā ā Reset counters to 0 ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
⨠Features
Core Features
| Feature | Description |
|---|---|
| Critical Hit Tracking | Detects vanilla-accurate critical hits using 11 strict conditions |
| Combo Hit Tracking | Detects sprint knockback hits for combo counting |
| Real-Time Display | Shows live counters in the Action Bar |
| Auto Reset | Counters automatically reset after 2 seconds of inactivity |
| Left-Aligned Display | Text positioned on left side of screen for better visibility |
| Hit Highlighting | Brief green flash when a hit is registered |
Persistence Features
| Feature | Description |
|---|---|
| Per-Player Toggle | Each player can enable/disable their display |
| Survives Relog | Preference saved using PersistentDataContainer |
| Survives Restart | Settings persist across server restarts |
| No External Storage | Data stored directly on player entity |
ā” Performance Features
| Feature | Description |
|---|---|
| Async Timer Checks | Reset detection runs on async thread |
| Efficient Data Storage | ConcurrentHashMap for thread-safe access |
| Minimal Overhead | Early-return conditions prevent unnecessary processing |
| Lazy Initialization | Data created only when player attacks |
| Lightweight Task | Timer runs every 5 ticks (0.25 seconds) |
ā ļø Critical Hit Detection
CombatMetrics uses vanilla-accurate detection that matches Minecraft's exact critical hit requirements. A hit is only counted as critical if ALL conditions are met:
Condition Checklist
| # | Condition | Method Used | Explanation |
|---|---|---|---|
| 1 | Falling | fallDistance > 0.0 |
Player must have positive fall distance |
| 2 | Airborne | !isOnGround() |
Player cannot be touching the ground |
| 3 | Not Climbing | !isClimbing() |
Cannot be on ladder, vine, or scaffolding |
| 4 | Not In Water | !isInWater() |
Cannot be submerged in water |
| 5 | Not In Lava | !isInLava() |
Cannot be submerged in lava |
| 6 | Not Swimming | !isSwimming() |
Cannot be using swimming animation |
| 7 | Not Gliding | !isGliding() |
Cannot be flying with Elytra |
| 8 | No Blindness | !hasPotionEffect(BLINDNESS) |
Blindness effect blocks crits |
| 9 | No Slow Falling | !hasPotionEffect(SLOW_FALLING) |
Slow falling prevents crits |
| 10 | Not Mounted | !isInsideVehicle() |
Cannot be riding any entity |
| 11 | Charged Attack | getAttackCooldown() > 0.9 |
Attack must be 90%+ charged |
Visual Representation
CRITICAL HIT VALIDATION
Player State Check Result
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
fallDistance > 0 ? āāāāāāāāāāāā ā PASS
ā
ā¼
!isOnGround() ? āāāāāāāāāāāā ā PASS
ā
ā¼
!isClimbing() ? āāāāāāāāāāāā ā PASS
ā
ā¼
!isInWater() ? āāāāāāāāāāāā ā PASS
ā
ā¼
!isInLava() ? āāāāāāāāāāāā ā PASS
ā
ā¼
!isSwimming() ? āāāāāāāāāāāā ā PASS
ā
ā¼
!isGliding() ? āāāāāāāāāāāā ā PASS
ā
ā¼
No BLINDNESS ? āāāāāāāāāāāā ā PASS
ā
ā¼
No SLOW_FALLING ? āāāāāāāāāāāā ā PASS
ā
ā¼
!isInsideVehicle()? āāāāāāāāāāāā ā PASS
ā
ā¼
attackCooldown > 0.9? āāāāāāāāāā ā PASS
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
ā
CRITICAL HIT REGISTERED ā
āļø Combo Hit Detection
Combo hits detect sprint knockback attacks - the enhanced knockback applied when a player hits an enemy while sprinting.
Condition Checklist
| # | Condition | Method Used | Explanation |
|---|---|---|---|
| 1 | Sprinting | isSprinting() |
Player must be actively sprinting |
| 2 | Charged Attack | getAttackCooldown() > 0.9 |
Attack must be 90%+ charged |
| 3 | Living Target | instanceof LivingEntity |
Target must be able to receive knockback |
Visual Representation
COMBO HIT VALIDATION
Player State Check Result
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
isSprinting() ? āāāāāāāāāāāā ā PASS
ā
ā¼
attackCooldown > 0.9? āāāāāāāāāā ā PASS
ā
ā¼
Target is Living? āāāāāāāāāāāā ā PASS
ā
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
ā¼
ā
COMBO HIT REGISTERED ā
ļø Visual Display System
Action Bar Format
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā
ā [ ā CRITS: 5 | ā COMBO: 3 ] ā
ā ā ā ā
ā āāā Left-aligned content āāā Invisible spacing pushes left ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Color Scheme
| Element | Color | Style |
|---|---|---|
[ ] |
Dark Gray | Normal |
ā |
Dark Red | Normal |
CRITS: |
Red | Bold |
| Crit Count | White | Normal |
| |
Dark Gray | Normal |
ā |
Gold | Normal |
COMBO: |
Yellow | Bold |
| Combo Count | White | Normal |
Hit Highlight Effect
When a hit is registered, the corresponding counter briefly highlights:
Normal Display:
[ ā CRITS: 5 | ā COMBO: 3 ]
ā ā
White White
After Critical Hit (3 ticks):
[ ā CRITS: 6 | ā COMBO: 3 ]
ā
GREEN + BOLD
After Combo Hit (3 ticks):
[ ā CRITS: 6 | ā COMBO: 4 ]
ā
GREEN + BOLD
Left-Alignment Technique
Minecraft's Action Bar centers text by default. To achieve left-alignment:
// Append invisible spacing after the content
Component content = actualContent
.append(Component.text(" ") // ~80 spaces
.color(NamedTextColor.BLACK)); // Invisible
This pushes the visible content to the left side of the screen, near the health/armor display.
ā±ļø Reset Timer System
How It Works
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā RESET TIMER SYSTEM ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā TIME āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā
ā HIT! RESET! ā
ā ā ā ā
ā ā¼ ā¼ ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāā 2000ms (40 ticks) āāāāāāāāāāāāāāāā ā
ā ā ā ā
ā lastHitTime currentTime ā
ā ā
ā ā
ā [Async Task - Every 5 ticks] ā
ā ā ā
ā ā¼ ā
ā if (currentTime - lastHitTime >= 2000ms) { ā
ā resetCounter(); ā
ā updateActionBar(); // Show 0 briefly ā
ā } ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Independent Timers
Critical and Combo counters have separate timers:
SCENARIO: Player lands a crit, then keeps doing combo hits
Time: 0s 1s 2s 3s 4s 5s
ā ā ā ā ā ā
Crits: [1]āāāāā[1]āāāāā[0] (reset at 2s)
ā ā ā
Combos: [1]āāāā[2]āāāā[3]āāāā[4]āāāāā[4]āāāāā[0]
ā ā
last combo reset at 5s
Grace Period
After counters reset to 0, there's a brief 500ms grace period before the display clears entirely:
HIT! ā 2 seconds ā RESET TO 0 ā 500ms ā CLEAR DISPLAY
ā
Show "[ ā CRITS: 0 | ā COMBO: 0 ]" briefly
Commands & Permissions
Commands
| Command | Description | Permission |
|---|---|---|
/metrics toggle |
Enable/disable action bar display | combatmetrics.use |
/metrics status |
View current stats and settings | combatmetrics.use |
/metrics reset |
Reset both counters to zero | combatmetrics.use |
Command Aliases
/combatmetrics/cm
Permissions
| Permission | Default | Description |
|---|---|---|
combatmetrics.use |
true |
Access to all player commands |
combatmetrics.admin |
op |
Reserved for future admin features |
Command Output Examples
Toggle ON:
ā Combat Metrics ENABLED
Your combat stats will now display in the action bar.
Toggle OFF:
ā Combat Metrics DISABLED
Action bar display has been turned off.
Status:
āāāāāā Combat Metrics Status āāāāāā
Display: ENABLED
Current Session:
ā Critical Hits: 15
ā Combo Hits: 23
Reset:
āŗ Counters have been reset!
Data Persistence
PersistentDataContainer (PDC) Storage
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā PERSISTENCE SYSTEM ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā Namespace: combatmetrics ā
ā Key: metrics_display_enabled ā
ā Type: BYTE ā
ā ā
ā Values: ā
ā 0 = Display DISABLED ā
ā 1 = Display ENABLED ā
ā null = Default to ENABLED ā
ā ā
ā Storage Location: Player Entity NBT Data ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Persistence Benefits
| Benefit | Description |
|---|---|
| No Files | No YAML/JSON configuration files per player |
| No Database | No MySQL/SQLite required |
| Automatic | Saved with player data automatically |
| Reliable | Survives crashes, restarts, and relogs |
| Lightweight | Single byte per player |
ā” Performance Analysis
Memory Usage
Per Player:
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā MetricData Object ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā int critCount = 4 bytes ā
ā int comboCount = 4 bytes ā
ā long lastCritTime = 8 bytes ā
ā long lastComboTime = 8 bytes ā
ā boolean needsUpdate = 1 byte ā
ā Object overhead ā 16 bytes ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā TOTAL ā 41 bytes ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
100 Players = ~4.1 KB memory
1000 Players = ~41 KB memory
CPU Usage
| Task | Frequency | Cost |
|---|---|---|
| Damage Event Handler | Per attack | Very Low (early returns) |
| Async Reset Checker | Every 5 ticks | Minimal (simple timestamp comparison) |
| Action Bar Update | On hit/reset | Low (Component creation) |
Optimization Techniques Used
| Technique | Implementation |
|---|---|
| Early Returns | Check cooldown first before other conditions |
| Async Processing | Timer checks run off main thread |
| ConcurrentHashMap | Thread-safe without locks |
| Lazy Loading | MetricData created on first attack |
| Minimal Allocations | Reuse patterns where possible |
| Event Priority | MONITOR priority - runs after other plugins |
Event Flow
Complete Event Lifecycle
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā COMPLETE EVENT FLOW ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā 1. EntityDamageByEntityEvent Fired ā
ā ā ā
ā ā¼ ā
ā 2. Check: Damager is Player? ā
ā ā NO ā EXIT ā
ā ā YES ā ā
ā ā¼ ā
ā 3. Check: Target is LivingEntity? ā
ā ā NO ā EXIT ā
ā ā YES ā ā
ā ā¼ ā
ā 4. Check: Attack Cooldown > 0.9? ā
ā ā NO ā EXIT (weak attack) ā
ā ā YES ā ā
ā ā¼ ā
ā 5. Check Critical Hit Conditions (11 checks) ā
ā ā PASS ā Increment Crit Counter ā
ā ā¼ ā
ā 6. Check Combo Hit Conditions (2 checks) ā
ā ā PASS ā Increment Combo Counter ā
ā ā¼ ā
ā 7. Either counter incremented? ā
ā ā NO ā EXIT ā
ā ā YES ā ā
ā ā¼ ā
ā 8. Check: Display Enabled for Player? ā
ā ā NO ā EXIT ā
ā ā YES ā ā
ā ā¼ ā
ā 9. Update Action Bar with Highlight ā
ā ā ā
ā ā¼ ā
ā 10. Schedule Highlight Removal (3 ticks) ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Async Reset Task Flow
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ASYNC RESET TASK ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā [Runs every 5 ticks on Async Thread] ā
ā ā ā
ā ā¼ ā
ā FOR each online player: ā
ā ā ā
ā ā¼ ā
ā Get MetricData (if exists) ā
ā ā NULL ā SKIP ā
ā ā EXISTS ā ā
ā ā¼ ā
ā Check: shouldResetCrit(currentTime)? ā
ā ā YES ā resetCrit() ā
ā ā¼ ā
ā Check: shouldResetCombo(currentTime)? ā
ā ā YES ā resetCombo() ā
ā ā¼ ā
ā Any reset occurred? ā
ā ā NO ā CONTINUE ā
ā ā YES ā ā
ā ā¼ ā
ā Schedule SYNC task: ā
ā - Update action bar ā
ā - Or clear if both expired ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Use Cases
PvP Servers
| Use Case | Benefit |
|---|---|
| Competitive PvP | Players can track their crit consistency |
| Practice Servers | Train timing for critical hits |
| Combo Training | Improve sprint-reset techniques |
| Tournaments | Verify critical hit mechanics |
PvE Servers
| Use Case | Benefit |
|---|---|
| Mob Farming | Optimize damage output |
| Boss Fights | Track DPS effectiveness |
| Speedrunning | Monitor combat efficiency |
Content Creators
| Use Case | Benefit |
|---|---|
| YouTube/Twitch | Visual feedback for viewers |
| Tutorials | Demonstrate critical hit mechanics |
| Challenges | Create crit-based achievements |
Statistics Tracking
What Gets Tracked
| Metric | Description | Reset Condition |
|---|---|---|
| Crit Count | Total critical hits in current streak | 2 seconds no crit |
| Combo Count | Total combo hits in current streak | 2 seconds no combo |
| Last Crit Time | Timestamp of most recent crit | On reset |
| Last Combo Time | Timestamp of most recent combo | On reset |
What Is NOT Tracked
| Not Tracked | Reason |
|---|---|
| All-time statistics | Would require database storage |
| Damage numbers | Beyond plugin scope |
| Kill/death counts | Other plugins handle this |
| Weapon types | Not relevant to hit detection |
Developer API
Accessing CombatMetrics
// Get plugin instance
CombatMetrics plugin = CombatMetrics.getInstance();
// Get the metric manager
MetricManager manager = plugin.getMetricManager();
Reading Player Data
// Get current stats
MetricData data = manager.getMetricData(player);
int crits = data.getCritCount();
int combos = data.getComboCount();
// Check if display is enabled
boolean enabled = manager.isDisplayEnabled(player);
Modifying Player Data
// Manually register hits
manager.registerCriticalHit(player);
manager.registerComboHit(player);
// Reset counters
manager.resetCounters(player);
// Toggle display
boolean newState = manager.toggleDisplay(player);
manager.setDisplayEnabled(player, true);
Custom Action Bar Updates
// Get data and update display
MetricData data = manager.getMetricData(player);
manager.updateActionBar(player, data);
// Update with highlight effect
manager.showHitWithHighlight(player, true, false); // Highlight crit
--
Compatibility
Server Software
| Software | Compatible | Notes |
|---|---|---|
| Paper 1.21.1+ | ā | Primary target |
| Paper 1.21.2 | ā | Fully supported |
| Paper 1.21.3 | ā | Fully supported |
| Paper 1.21.4 | ā | Fully supported |
| Paper 1.21.5 | ā | Fully supported |
| Paper 1.21.6 | ā | Fully supported |
| Paper 1.21.7 | ā | Fully supported |
| Paper 1.21.8 | ā | Fully supported |
| Spigot | ā ļø | May work, untested |
| Bukkit | ā | Missing Adventure API |
| Folia | ā ļø | Requires region-aware modifications |
Java Versions
| Java | Compatible |
|---|---|
| Java 21 | ā Required |
| Java 22+ | ā Should work |
| Java 17 | ā Too old for Paper 1.21 |
Plugin Conflicts
| Plugin Type | Compatibility |
|---|---|
| Combat plugins | ā Runs on MONITOR priority |
| Action bar plugins | ā ļø May overwrite display |
| Anticheat plugins | ā No conflicts |
| Protection plugins | ā Respects cancelled events |
Installation
Step-by-Step
- Download the
CombatMetrics-1.0.0.jarfile - Stop your server
- Place the JAR in your
plugins/folder - Start your server
- Verify with
/plugins- should show green
First-Time Setup
No configuration required! The plugin works out of the box:
- Display is enabled by default for all players
- Players can toggle with
/metrics toggle - Settings automatically persist
Changelog
Version 1.0.0
- Initial release
- Critical hit detection (11 conditions)
- Combo hit detection (3 conditions)
- Action bar display with left-alignment
- Auto-reset after 2 seconds
- PDC-based persistence
- Toggle/status/reset commands
- Async timer task
- Hit highlight effects
FAQ
Q: Why doesn't it detect my critical hits?
A: Ensure your attack is fully charged (90%+) and you're falling without any blocking conditions (water, climbing, slow falling, etc.)
Q: Can both Crit and Combo trigger on the same hit?
A: Yes! If you're falling AND sprinting with a charged attack, both counters will increment.
Q: Does this work in creative mode?
A: Yes, but attack cooldown is always 1.0 in creative, so timing doesn't matter.
Q: Will this cause lag?
A: No. The plugin uses async processing and minimal memory. Tested with 100+ players.
Q: Can I customize the display colors?
A: Not in this version. Colors are hardcoded for consistency.
Q: Does it track hits on all entities?
A: Only hits on LivingEntity (mobs, players, animals, etc.)
Summary
CombatMetrics provides:
ā Accurate vanilla-matching critical hit detection ā Real-time action bar display ā Automatic 2-second reset timers ā Persistent per-player preferences ā Performant async processing ā Simple toggle commands ā Zero configuration required ā Zero dependencies
Perfect for PvP servers, practice servers, and any server where players want to track their combat effectiveness!**


