Skip to content

Bonemealing saplings results in tree different than the sapling due to using shared static variable for all events #13092

@raikasdev

Description

@raikasdev

Expected behavior

Saplings (and the resulting StructureGrowEvent TreeType) should result in the corresponding tree growing.

Observed/Actual behavior

Different plants and structures grow instead.

Steps/models to reproduce

We haven't been able to reproduce this in a small scale (development servers), only on our production server with ~40 online players spread on a large map and multiple worlds. We have a custom tree growing plugin (developed by us) that relies on the StructureGrowEvent and uses the .getSpecies() (TreeType) directly, so that value is already wrong:

This is likely due to this singleton/static value logic used in multiple places (eg. SaplingBlock.java):

org.bukkit.TreeType treeType = SaplingBlock.treeType;
SaplingBlock.treeType = null;

And this value is shared for all grow events. If an another plant grows before the bone mealing is complete, it will get replaced and grown instead.

Similar code is also used in ItemStack.java (in useOn method), I'm not sure which gets used but both rely on the same logic (depending on TreeGrower.java to set the value).

Plugin and Datapack List

Custom plugins: Abydos, AbydosPluginCheck

Apollo-Bukkit, BlueMap, CoreProtect, FastAsyncWorldEdit, GSit, InvSeePlusPlus, LuckPerms, Multiverse-Core, packetevents, ProtocollLib, SimpleWarps, SuperVanish, WorldGuard

Paper version

This server is running Paper version 1.21.8-60-main@29c8822 (2025-09-06T21:49:13Z) (Implementing API version 1.21.8-R0.1-SNAPSHOT)

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.version: 1.21.8Game version 1.21.8

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions