Skip to content

Add ItemsAdder and Oraxen custom block limits#288

Merged
tastybento merged 1 commit into
masterfrom
feat/176-itemsadder-oraxen
Jul 10, 2026
Merged

Add ItemsAdder and Oraxen custom block limits#288
tastybento merged 1 commit into
masterfrom
feat/176-itemsadder-oraxen

Conversation

@tastybento

Copy link
Copy Markdown
Member

Fixes #176.

Config

No new section — custom ids go straight into the existing blocklimits machinery (including -nether/-end and worlds: overrides):

blocklimits:
  HOPPER: 10
  "iafestivities:christmas/christmas_tree/green_orb": 5   # ItemsAdder namespaced id
  "oraxen:caveblock": 10                                   # Oraxen id, oraxen: prefix

The parser already produced NamespacedKeys for colon keys; registerLimit now accepts non-minecraft namespaces instead of rejecting them, and the per-env data model stores them natively (no migration).

How enforcement works

Two thin listeners, registered only when the respective plugin is installed (no hard dependency; the API jars are provided at the same versions BentoBox compiles against):

  • ItemsAdderListenerCustomBlockPlaceEvent / CustomBlockBreakEvent
  • OraxenListener — note-block and string-block place/break events

Both feed processKey, a public extraction of the existing count/limit core, so island lookup, per-environment limits, offsets, save batching, and the limits GUI (paper icon + prettified name) all work unchanged. Listening to the plugins' own events is what fixes the 2023 blocker on this ticket — the old prototype raced Bukkit's block events and the block placed anyway; the custom events can't desync that way.

The recount chunk scan can't see custom blocks (they're physically note blocks etc.), so RecountCalculator now carries non-minecraft counts across the reset instead of zeroing them. Documented in the config comments.

Deliberate v1 scope

  • Oraxen furniture (entity-based) is not limited — note-block/string-block mechanics only.
  • Permission-based limits don't match custom ids (perm segments are dot-separated; custom ids contain colons/slashes). Offsets via the admin command work.
  • Per the ticket discussion: API access is BentoBox-hook style (no plugin API calls beyond their events); Nexo support would start with a BentoBox hook.

Testing

JUnit covers processKey (limit hit, count, decrement for a custom key), config parsing of custom keys, and id→key mapping. The listeners themselves need in-game verification with the real plugins@Olthoo offered to test back in 2023 and users were still asking in 2025:

  1. Install ItemsAdder, add a custom block id with limit 2 to blocklimits, restart.
  2. Place 2 of the block → 3rd is blocked with the hit-limit message and the block does not appear (this was the 2023 failure mode).
  3. Break one → placement works again. /is limits shows the custom entry (paper icon).
  4. /is limits recount → the custom count is unchanged afterwards.
  5. Repeat with an Oraxen note-block id under "oraxen:<id>".
  6. Explosion/piston removal of a custom block → verify the plugin fires its break event and the count drops (if a gap shows up here, recount preserves rather than fixes custom counts — report it).

🤖 Generated with Claude Code

https://claude.ai/code/session_015dbJyrv2uxHfTmiWkqGUJB

@tastybento tastybento force-pushed the feat/176-itemsadder-oraxen branch 2 times, most recently from 20fdc22 to 886f8a5 Compare July 10, 2026 20:44
Custom block ids can now be used directly as blocklimits keys (all
sections: blocklimits, -nether, -end, worlds): ItemsAdder ids as-is
(namespace:id), Oraxen ids prefixed "oraxen:". The config parser already
produced NamespacedKeys; registerLimit now accepts non-minecraft
namespaces instead of rejecting them.

Enforcement listens to the plugins' own place/break events (fixing the
2023 event-ordering problem where the alert fired but the block still
placed) through new soft-registered listeners that only load when the
respective plugin is present. Both feed processKey, a public extraction
of the existing count/limit core, so island lookup, per-env limits,
offsets, batching, and the GUI all work unchanged - custom keys render
with a paper icon and prettified name.

Custom counts are event-tracked and invisible to the recount chunk scan,
so the recount now carries non-minecraft counts across the reset instead
of zeroing them.

Fixes #176

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015dbJyrv2uxHfTmiWkqGUJB
@tastybento tastybento force-pushed the feat/176-itemsadder-oraxen branch from 886f8a5 to 1146553 Compare July 10, 2026 20:44
@tastybento tastybento merged commit f428441 into master Jul 10, 2026
1 check passed
@sonarqubecloud

Copy link
Copy Markdown

tastybento added a commit that referenced this pull request Jul 10, 2026
Brings the eight feature merges (#281-#288) into the release branch and
reconciles them with develop's #276 copper golem chest limit and #277
quiet join logging:
- pom.xml: master's dependency additions with develop's 1.29.0 bump.
- JoinListener: the once-per-join log banner from #277 applied to the
  refactored mergePerms loop.
- EntityLimitListener: copper golem checks grafted onto master's version;
  tellPlayersBlockLimit now respects show-limit-messages and uses the
  locale name translations, consistent with the other notify sites.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015dbJyrv2uxHfTmiWkqGUJB
@tastybento tastybento mentioned this pull request Jul 10, 2026
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.

1 participant