Add block damage abort event#8766
Conversation
| on block damage abort: | ||
| send "You stopped damaging %event-block% with %event-item%." to event-player | ||
| """) | ||
| .addSince("2.16") |
There was a problem hiding this comment.
| .addSince("2.16") | |
| .addSince("INSERT VERSION") |
|
|
||
| public class EvtBlockDamageAbort extends SimpleEvent { | ||
|
|
||
| public EvtBlockDamageAbort() { |
There was a problem hiding this comment.
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; | |||
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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);
|
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. |
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 abortevent under the modern block module and register it throughSyntaxRegistry.The event exposes the documented player and item stack through
EventValueRegistry; the inherited block event value remains available asevent-block. A parser test covers all three values.Testing Completed
clean quickTeston Paper 26.1.2 with JDK 25: 792 script tests succeeded, 0 failed, documentation tests passedclean checkstyleMain: build passed, with no Checkstyle violations inBlockModuleorEvtBlockDamageAbortSupporting Information
The implementation is located in
org.skriptlang.skript.bukkit.block.elements.eventsand 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.