Skip to content

Add PROJECTILE_DAMAGE kit rule and fix arrow damage #190

Open
abcdxyz6969 wants to merge 1 commit into
Solara-Development:masterfrom
abcdxyz6969:1
Open

Add PROJECTILE_DAMAGE kit rule and fix arrow damage #190
abcdxyz6969 wants to merge 1 commit into
Solara-Development:masterfrom
abcdxyz6969:1

Conversation

@abcdxyz6969
Copy link
Copy Markdown

No description provided.

- 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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_DAMAGE and applies it when handling EntityDamageByEntityEvent projectile damage.
  • Updates kit rule loading/defaults to support the new rule, including fallback behavior from DAMAGE.
  • Improves attacker attribution in onEntityDamageByEntityMonitor via getResponsiblePlayer(...) (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 if rules does not contain the requested rule (e.g., when a Kit is created from an external IKit/older persisted map that predates PROJECTILE_DAMAGE). Since is() now explicitly handles missing rules, consider making toggle() null-safe as well (e.g., use getOrDefault/Boolean.TRUE.equals and then put).
    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.

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