Skip to content

SnLib v1.21.1

Choose a tag to compare

@ValentinTarnovsky ValentinTarnovsky released this 04 Aug 12:46
· 11 commits to main since this release

Changes

Refinements to the 1.21.0 plugin-supplied stack surface. No API change - SnApi.LEVEL stays 13 and nothing public was added, removed or altered.

The pass-through is now structural

A template that declares neither display-name nor lore adds nothing to a supplied stack: no appended empty line, no cleared lore, no name written, no normalising pass. This already held in 1.21.0, but it held by convention - the item meta was still fetched. The emptiness test now runs before the meta is fetched at all, so a bare template cannot write to the stack even by accident. The result is the plain clone, equal to the input field for field.

Every shape of "undeclared" reaches that same guarantee: an absent key, display-name: "", and lore: []. The distinction it rests on is unchanged and now tested head-on:

raw-item:        # adds nothing at all
  click-actions:
    - "[player] kit claim {kit}"
spaced-item:
  lore:
    - ""         # a list holding an empty string DOES append a blank line
    - "&7Click to claim"

Scope, stated honestly: this is the contract of the overlay. The stack that reaches the inventory still carries the snlib_gui_item anti-theft marker - one PDC key, written after the overlay runs, as on every rendered GUI stack since 1.0.0.

The allocation cost is documented instead of implied

docs/SNLIB-DOCS.md section 12 now itemizes it, so a consumer can size the surface from facts:

  • Per bind: one Ph[] clone, one Binding record, one ItemStack clone.
  • Per render: one ItemStack clone always, plus one Component per name and lore line the template actually declares - and nothing else for a bare template.
  • Strictly cheaper than the SnItem.fromConfig render it stands in for (~20 YAML reads plus a full meta write).
  • Sizing: built for opens, refreshes, page changes and update-interval: ticks. A per-frame full-strip repaint at animation rates belongs on a raw Bukkit inventory.

484 tests across 22 suites green; additive-only japicmp gate clean.

Installation

Download the JAR below and place it in your plugins folder, replacing the previous SnLib.jar. Updating SnLib requires a server restart; never hot-reload it.