feat: MiniMessage locales on Paper + cloplib entity protection - #2
Closed
noaskers wants to merge 2 commits into
Closed
feat: MiniMessage locales on Paper + cloplib entity protection#2noaskers wants to merge 2 commits into
noaskers wants to merge 2 commits into
Conversation
Paper 26.2 ships Adventure 5, which drops the ClickEvent.Action enum that MineDown compiles against, so MineDown can no longer format messages there. Message formatting moves behind a MessageFormatter interface with two implementations: MineDownFormatter for Bukkit and Fabric, and MiniMessageFormatter for Paper, backed by a parallel set of MiniMessage locale files. The formatter in use decides which locale file is loaded, and switching markup format rewrites the existing messages file rather than leaving a second one behind for the other format. A malformed messages file falls back to the bundled locale instead of failing to enable the plugin. Fabric configures through Loom, so its setup failing breaks configuration for unrelated tasks; -Dhuskclaims.skipFabric=true leaves those projects out of the build.
Two ways to harm entities inside a claim from outside it.
End crystals (and player-lit TNT) detonated just outside a boundary kill
players and destroy armour stands inside it. cloplib resolves the damager
before the cause, and getPlayerSource() unwraps projectile shooters and
passengers, so a blast attributable to a player is checked against
player_damage_player rather than explosion_damage_entity. That flag is on
by default, so the damage goes through. Checked here at LOW, ahead of
cloplib, so the explosion flag applies regardless of attribution.
Spears use the piercing_weapon component, which applies knockback without
dealing damage, so no damage event fires and an armour stand can be shoved
out of a claim. cloplib 2.0.13 handles EntityPushedByEntityAttackEvent in
its new paper module; PaperListener implements PaperEntityDamageListener
and inherits the handler, so no reflection is needed.
cloplib-paper is an implementation rather than compileOnly dependency, as
the interface must be present at runtime for PaperListener to load. The
cloplib version moves to a gradle property, with mavenLocal() ahead of the
remote repositories, so a locally published build can be tested with:
./gradlew :paper:build -Pcloplib_version=<local version>
Closes WiIIiam278#479
Closes WiIIiam278#461
Closes WiIIiam278#497
Closes WiIIiam278#297
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits, on top of the fork's master.
1. MiniMessage locales on Paper
Paper 26.2 ships Adventure 5, which drops the
ClickEvent.Actionenum MineDown compiles against, so MineDown can no longer format messages there. Formatting moves behind aMessageFormatterinterface with two implementations:MineDownFormatterfor Bukkit/Fabric andMiniMessageFormatterfor Paper, backed by a parallel set of MiniMessage locale files.The formatter in use decides which locale file loads, and switching markup format rewrites the existing messages file rather than leaving a second one behind. A malformed messages file falls back to the bundled locale instead of failing to enable the plugin.
-Dhuskclaims.skipFabric=trueleaves the Fabric projects out of the build, so a Loom failure doesn't break configuration for unrelated tasks.2. cloplib Paper listener for entity protection
Supersedes WiIIiam278#504 — this replaces that PR's reflection with a native listener.
Explosions. cloplib resolves the damager before the cause, and
getPlayerSource()unwraps projectile shooters and passengers, so a blast attributable to a player is checked againstplayer_damage_playerrather thanexplosion_damage_entity. That flag is on by default, so end crystals detonated just outside a claim boundary killed players and destroyed armour stands inside it. Checked atLOW, ahead of cloplib, so the explosion flag applies regardless of attribution.Knockback. Spears use the
piercing_weaponcomponent, which applies knockback without dealing damage, so no damage event fires and an armour stand can be shoved out of a claim. cloplib 2.0.13 handlesEntityPushedByEntityAttackEventnatively in its new paper module;PaperListenerimplementsPaperEntityDamageListenerand inherits the handler — no reflection.Closes WiIIiam278#479, WiIIiam278#461, WiIIiam278#497, WiIIiam278#297.
Dependency note
Requires cloplib 2.0.13, from noaskers/ClopLib
feat/paper-module-entity-fixes(both bug fixes + the new paper module). That has to merge and publish before this builds on CI.cloplib_versiondefaults to2.0.12ingradle.propertiesso existing builds are unaffected; test against a local publish with:cloplib-paperis animplementationrather thancompileOnlydependency — verified: withcompileOnlythe relocatedPaperEntityDamageListenerclass is absent from the shaded jar, andPaperListenerimplements it, so the server would fail at class load.Testing
:common:test,:bukkit:build,:paper:buildall pass — 16 tests, 0 failures.