Skip to content

Fix OFFLINE_GROWTH: block vine spread and tree growth from saplings#2968

Draft
Copilot wants to merge 3 commits intodevelopfrom
copilot/fix-offline-growth-issue
Draft

Fix OFFLINE_GROWTH: block vine spread and tree growth from saplings#2968
Copilot wants to merge 3 commits intodevelopfrom
copilot/fix-offline-growth-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

OFFLINE_GROWTH=off correctly blocked crops but left vines (and other spreading plants) and all tree types growing freely. Two root causes:

  1. onSpread(BlockSpreadEvent) had a hard-coded material allowlist (KELP, BAMBOO, BAMBOO_SAPLING) — everything else (vines, cave vines, twisting/weeping vines, glow lichen, …) passed through unchecked.
  2. Trees growing from saplings fire StructureGrowEvent, not BlockGrowEvent — no handler existed for it at all.

Changes

OfflineGrowthListener

  • Drop the material filter from onSpread entirely; all BlockSpreadEvents on protected islands are now checked. Switch island lookup to e.getSource().getLocation() (the existing plant, always on the island) instead of the destination block which may be outside the protection zone.
  • Add onStructureGrow(StructureGrowEvent) handler — covers all tree and mushroom growth from saplings (oak, birch, spruce, jungle, acacia, dark oak, mangrove, …).
  • Extract the duplicated per-member online-check into a private checkGrowth(Location, Cancellable) helper shared by all three handlers.
// Before: only three materials were ever blocked
Material m = e.getBlock().getType();
if (!m.equals(Material.KELP) && !m.equals(Material.BAMBOO) && !m.equals(Material.BAMBOO_SAPLING)) {
    return; // vines, weeping vines, etc. all slipped through here
}

// After: all spreading is checked; source location used for island lookup
checkGrowth(e.getSource().getLocation(), e);

OfflineGrowthListenerTest

  • Updated testOnSpreadMembersOfflineAnyMaterial (formerly …Tree): now uses Material.VINE and asserts the spread is blocked.
  • Added 6 tests for onStructureGrow: flag allowed, member online, member offline, non-island, non-BentoBox world, and bone-meal-triggered growth.

Copilot AI linked an issue May 5, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 5, 2026 15:24
…tructureGrowEvent

- Remove the restrictive material filter from onSpread (was KELP/BAMBOO/BAMBOO_SAPLING only)
  so vines, cave vines, twisting vines, weeping vines, and all other spreading plants
  are now blocked when island members are offline
- Use e.getSource().getLocation() for the island check in onSpread (source = the plant
  causing the spread, always on the island)
- Add onStructureGrow(StructureGrowEvent) handler so trees and mushrooms that grow
  from saplings (birch, spruce, acacia, mangrove, etc.) are blocked when offline
- Extract repeated island-member check into private checkGrowth() helper
- Update testOnSpreadMembersOfflineTree: all spread is now blocked (no material filter)
- Add 6 new tests covering the StructureGrowEvent handler (doNothing, membersOnline,
  membersOffline, nonIsland, nonBentoBoxWorld, boneMealMembersOffline)

Agent-Logs-Url: https://github.com/BentoBoxWorld/BentoBox/sessions/31b42c78-d289-4a32-bded-77f467a43797

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix offline growth behavior for all plant types Fix OFFLINE_GROWTH: block vine spread and tree growth from saplings May 5, 2026
Copilot AI requested a review from tastybento May 5, 2026 15:29
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.

Offline growth

2 participants