Skip to content

Pre Player Attack Entity#8329

Merged
APickledWalrus merged 39 commits intoSkriptLang:dev/featurefrom
MrScopes:preplayerattack
Mar 31, 2026
Merged

Pre Player Attack Entity#8329
APickledWalrus merged 39 commits intoSkriptLang:dev/featurefrom
MrScopes:preplayerattack

Conversation

@MrScopes
Copy link
Copy Markdown
Contributor

@MrScopes MrScopes commented Dec 23, 2025

Problem

This event could be useful in some situations.
https://jd.papermc.io/paper/1.21.11/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.html

Solution

Added on attempt attack and on attempt[ing] to attack %entitydatas%
Added [the] (entity|victim) (:will|will not|won't) be attack(ed|ing) decided not to include since it's effectively useless. the event is fired as canceled if the entity won't be attacked

Testing Completed

Tested my examples given. Everything works as expected

                    on attack attempt:
                        if event is cancelled:
                            broadcast "%attacker% failed to attack %victim%!"
                        else:
                            broadcast "%attacker% damaged %victim%!"

                    on attempt to attack an animal:
                        cancel event        

                    on attempting to attack an entity:
                        if victim is a creeper:
                            cancel event     

                    on attempt to attack a zombie or creeper:
                        attacker isn't holding a diamond sword
                        cancel event

Supporting Information

ExprAttacked and ExprAttacker also updated to support this event, and I also updated the code in both classes to follow new conventions


Completes: 8266
Related: none
AI assistance: none

@MrScopes MrScopes requested a review from a team as a code owner December 23, 2025 08:26
@MrScopes MrScopes requested review from Pesekjak and TheMug06 and removed request for a team December 23, 2025 08:26
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Dec 23, 2025
@sovdeeth
Copy link
Copy Markdown
Member

Note that listening to cancelled events does not require the config, you can simply do on cancelled X or on any X

@MrScopes
Copy link
Copy Markdown
Contributor Author

Note that listening to cancelled events does not require the config, you can simply do on cancelled X or on any X

Good to know. I can update the examples and description with that + whatever else is decided

@sovdeeth sovdeeth added the feature Pull request adding a new feature. label Dec 24, 2025
Copy link
Copy Markdown
Member

@Efnilite Efnilite left a comment

Choose a reason for hiding this comment

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

looks good after sovde's changes

@skriptlang-automation skriptlang-automation bot added needs reviews A PR that needs additional reviews and removed needs reviews A PR that needs additional reviews labels Dec 25, 2025
@MrScopes
Copy link
Copy Markdown
Contributor Author

MrScopes commented Jan 2, 2026

Decided on

on attempt[ing] to attack %entitydatas%
on attack attempt

@MrScopes MrScopes requested review from Efnilite and sovdeeth January 6, 2026 01:28
Copy link
Copy Markdown
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

looking good!

@skriptlang-automation skriptlang-automation bot added feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. and removed needs reviews A PR that needs additional reviews labels Mar 27, 2026
@APickledWalrus APickledWalrus moved this from In Review to Awaiting Merge in 2.15 Releases Mar 30, 2026
@APickledWalrus APickledWalrus merged commit 812eea0 into SkriptLang:dev/feature Mar 31, 2026
9 checks passed
@skriptlang-automation skriptlang-automation bot added the completed The issue has been fully resolved and the change will be in the next Skript update. label Mar 31, 2026
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.15 Releases Mar 31, 2026
@skriptlang-automation skriptlang-automation bot removed the feature-ready A PR/issue that has been approved, tested and can be merged/closed in the next feature version. label Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

completed The issue has been fully resolved and the change will be in the next Skript update. feature Pull request adding a new feature.

Projects

Status: Done - Awaiting Release

Development

Successfully merging this pull request may close these issues.

4 participants