Skip to content

Add block damage abort event#8766

Open
jonasHanhan wants to merge 2 commits into
SkriptLang:dev/featurefrom
jonasHanhan:agent/add-block-damage-abort-event
Open

Add block damage abort event#8766
jonasHanhan wants to merge 2 commits into
SkriptLang:dev/featurefrom
jonasHanhan:agent/add-block-damage-abort-event

Conversation

@jonasHanhan

Copy link
Copy Markdown

Problem

Skript has no event for Paper's BlockDamageAbortEvent, so scripts cannot detect when a player stops damaging a block before it breaks.

Solution

Add an on block damage abort event under the modern block module and register it through SyntaxRegistry.

The event exposes the documented player and item stack through EventValueRegistry; the inherited block event value remains available as event-block. A parser test covers all three values.

Testing Completed

  • clean quickTest on Paper 26.1.2 with JDK 25: 792 script tests succeeded, 0 failed, documentation tests passed
  • clean checkstyleMain: build passed, with no Checkstyle violations in BlockModule or EvtBlockDamageAbort

Supporting Information

The implementation is located in org.skriptlang.skript.bukkit.block.elements.events and uses the current syntax and event-value registries as requested in the issue discussion.


Completes: #8752
Related: none
AI assistance: OpenAI Codex was used to inspect project conventions, implement the event and registry wiring, add test coverage, and run and interpret the Gradle checks. I reviewed the final diff and test results before submission.

@jonasHanhan jonasHanhan requested a review from a team as a code owner July 10, 2026 03:29
@jonasHanhan jonasHanhan requested review from TheMug06 and erenkarakal and removed request for a team July 10, 2026 03:29

@AnOwlBe AnOwlBe left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

few things

on block damage abort:
send "You stopped damaging %event-block% with %event-item%." to event-player
""")
.addSince("2.16")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
.addSince("2.16")
.addSince("INSERT VERSION")


public class EvtBlockDamageAbort extends SimpleEvent {

public EvtBlockDamageAbort() {

@AnOwlBe AnOwlBe Jul 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this isn't needed I don't think the (public EvtBlockDamageAbort() { with the super)

@@ -0,0 +1,46 @@
package org.skriptlang.skript.bukkit.block.elements.events;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since this whole event has nothing special theres no need for it to be its own file - hence why I would've suggested it goes in BlockEvents but that isn't in dev/feature yet but its definitely something to note since it'll probably need to be moved there once it is in dev/feature

// intentionally left blank
EventValueRegistry eventValueRegistry = addon.registry(EventValueRegistry.class);
register(addon,
syntaxRegistry -> EvtBlockDamageAbort.register(syntaxRegistry, eventValueRegistry)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

theres no need for this to be inside a register(addon since its only a single thing simply instead can be 1 line of EvtBlockDamageAbort.register(syntaxRegistry, eventValueRegistry);

@sovdeeth

Copy link
Copy Markdown
Member

You need to actually test your changes manually ingame! the tests passing here mean very little since none of the event's logic is actually tested.

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.

3 participants