Repository navigation
Conversation
Cushions (26.3) are block-attached entities but not Hanging, so Paper fires io.papermc.paper.event.entity.EntityBreakByEntityEvent instead of HangingBreakByEntityEvent. Move the hanging break checks into shouldCancelEntityBreak() and register a reflective handler for the new event (only if it exists at runtime, only inside plot areas). Fixes IntellectualSites#4959
|
I'll review this shortly and see how it compares to the fix I was working on. Hopefully I can give this a quick approval so we can get it merged in. |
|
I'm not a fan of this approach - why not just update the paper dependency and register the listener (in a separate class) when running the appropriate Minecraft version? |
|
@MattBDev thanks for the quick look — glad if this can go in soon! @PierreSchwang fair point. Some background on the reflection bridge: PlotSquared compiles against Honestly both ways are fine by me — just let me know what you prefer. If you're ok with the bump, point me at the target |
|
From a quick glance from my phone since I'm not at my computer, I believe this is the exact approach I originally took to solve the issue. I ended up just creating another branch with updated JDK and api requirements because I wasn't a fan of the approach but understood it was probably the only approach given our current dependency restriction. |
|
Thanks for the feedback, @MattBDev! As mentioned above, happy to switch it to a direct listener if the team goes with Java 25. |
Hey! On 26.3, players who aren't added to a plot can break cushions there (#4959). I looked into it: a cushion is a block-attached entity, but not a
Hanging, so Paper doesn't fireHangingBreakByEntityEventfor it. It fires the newio.papermc.paper.event.entity.EntityBreakByEntityEventinstead, and PlotSquared doesn't listen to that yet.What I changed:
onHangingBreakByEntityintoshouldCancelEntityBreak(remover, entity). Hanging entities behave exactly the same as before.EntityBreakEventBridge, which registers a handler forEntityBreakByEntityEventreflectively. It only does that if the class exists at runtime, since PlotSquared still compiles against the 1.21.1 API, and it only applies to entities inside a plot area.So cushions now follow the same rules as item frames and paintings, including the
hanging-breakflag. If you'd rather have a separate flag for them, let me know and I'll change it.It compiles fine. I haven't been able to test this exact build on a live 26.3 server yet.
Fixes #4959