Add PROJECTILE_DAMAGE kit rule and fix arrow damage #190
Open
abcdxyz6969 wants to merge 1 commit into
Open
Conversation
- Add PROJECTILE_DAMAGE KitRule (icon ARROW, saveName projectileDamage) so arrow/trident damage can be toggled independently from the existing DAMAGE rule. - Fix Kit#rules() default map where the DAMAGE entry was always overwritten to false right after being set to true. New kits now default DAMAGE and PROJECTILE_DAMAGE to true. - Make Kit#is(KitRule) null-safe so existing kit configs without the new projectileDamage key don't throw NPE; PROJECTILE_DAMAGE falls back to the value of DAMAGE. - KitService now loads projectileDamage with a fallback that matches the kit's damage setting, preserving behavior for kits saved before this change. - MatchListener#onEntityDamage now checks whether the damage came from a Projectile and gates it on PROJECTILE_DAMAGE instead of DAMAGE, so kits can allow ranged damage while disabling melee or vice-versa. - MatchListener#onEntityDamageByEntityMonitor uses getResponsiblePlayer(event) so arrow / TNT / potion kills credit the shooter (lastAttacker, kill sound, death message). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new kit rule to independently control projectile damage (e.g., arrows/tridents) and updates match damage attribution so projectile hits are associated with the responsible player.
Changes:
- Introduces
KitRule.PROJECTILE_DAMAGEand applies it when handlingEntityDamageByEntityEventprojectile damage. - Updates kit rule loading/defaults to support the new rule, including fallback behavior from
DAMAGE. - Improves attacker attribution in
onEntityDamageByEntityMonitorviagetResponsiblePlayer(...)(fixing arrow/projectile attacker tracking).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Plugin/src/main/java/dev/lrxh/neptune/game/match/listener/MatchListener.java | Uses responsible-player attribution for PvP damage tracking and applies projectile-vs-generic damage kit rules. |
| Plugin/src/main/java/dev/lrxh/neptune/game/kit/KitService.java | Loads PROJECTILE_DAMAGE with fallback to the existing DAMAGE config value. |
| Plugin/src/main/java/dev/lrxh/neptune/game/kit/Kit.java | Sets defaults to include PROJECTILE_DAMAGE and adds null-safe rule lookup with fallback behavior. |
| Plugin/src/main/java/dev/lrxh/neptune/game/kit/impl/KitRule.java | Adds the new PROJECTILE_DAMAGE kit rule enum value. |
Comments suppressed due to low confidence (1)
Plugin/src/main/java/dev/lrxh/neptune/game/kit/Kit.java:179
toggle(KitRule kitRule)can throw a NullPointerException ifrulesdoes not contain the requested rule (e.g., when aKitis created from an externalIKit/older persisted map that predatesPROJECTILE_DAMAGE). Sinceis()now explicitly handles missing rules, consider makingtoggle()null-safe as well (e.g., usegetOrDefault/Boolean.TRUE.equalsand thenput).
public void toggle(KitRule kitRule) {
rules.put(kitRule, !rules.get(kitRule));
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.