[SPIGOT-7518] Console error when applying bonemeal Created: 12/Nov/23  Updated: 25/Dec/24  Resolved: 13/Nov/23

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: tastybento Assignee: Parker Hawke
Resolution: Fixed Votes: 1
Labels: None

Attachments: File TestPlugin-1.11.2-SNAPSHOT-LOCAL.jar    
Version: This server is running CraftBukkit version 3936-Spigot-dba3cdc-5a2d905 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Block#applyBoneMeal thows console errors when used (see below). It does apply the bonemeal, so the console errors are mostly spam.

Minimal plugin:

public class TestPlugin extends JavaPlugin implements Listener {
	@Override
	public void onEnable() {
		getLogger().info("Test plugin loaded");
		Bukkit.getPluginManager().registerEvents(this, this);
	}
	@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
	public void onDancing(PlayerToggleSneakEvent event) {
event.getPlayer().getTargetBlockExact(10).applyBoneMeal(BlockFace.UP);
	}
}

Look at a ground spot and press left-shift to crouch. That'll make the error.

 

[13:31:16] [Server thread/ERROR]: Could not pass event PlayerToggleSneakEvent to TestPlugin v1.0
org.bukkit.event.EventException: null
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2137) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.network.protocol.game.PacketPlayInEntityAction.a(SourceFile:37) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.network.protocol.game.PacketPlayInEntityAction.a(SourceFile:7) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:32) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1133) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.bg(MinecraftServer.java:1112) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1105) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandler.bp(SourceFile:115) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.u_(MinecraftServer.java:1088) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1000) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:298) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.player.EntityHuman.a(net.minecraft.world.level.gameevent.GameEvent)" because the return value of "net.minecraft.world.item.context.ItemActionContext.o()" is null
	at net.minecraft.world.item.ItemBoneMeal.applyBonemeal(ItemBoneMeal.java:49) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at org.bukkit.craftbukkit.v1_20_R2.block.CraftBlock.applyBoneMeal(CraftBlock.java:473) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at us.tastybento.test.TestPlugin.onDancing(TestPlugin.java:21) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	... 20 more
[13:31:16] [Server thread/ERROR]: Could not pass event PlayerToggleSneakEvent to TestPlugin v1.0
org.bukkit.event.EventException: null
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:2137) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.network.protocol.game.PacketPlayInEntityAction.a(SourceFile:37) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.network.protocol.game.PacketPlayInEntityAction.a(SourceFile:7) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:32) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.TickTask.run(SourceFile:18) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:156) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1133) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:130) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.bg(MinecraftServer.java:1112) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1105) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:139) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.u_(MinecraftServer.java:1089) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1000) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:298) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.player.EntityHuman.a(net.minecraft.world.level.gameevent.GameEvent)" because the return value of "net.minecraft.world.item.context.ItemActionContext.o()" is null
	at net.minecraft.world.item.ItemBoneMeal.applyBonemeal(ItemBoneMeal.java:49) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at org.bukkit.craftbukkit.v1_20_R2.block.CraftBlock.applyBoneMeal(CraftBlock.java:473) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:3936-Spigot-dba3cdc-5a2d905]
	at us.tastybento.test.TestPlugin.onDancing(TestPlugin.java:21) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
	... 20 more

 

 



 Comments   
Comment by Parker Hawke [ 12/Nov/23 ]

Thank you tastybento!

Comment by tastybento [ 12/Nov/23 ]

I apologize. I usually do and forgot this time. I just updated with the Spigot test and data.

Comment by Parker Hawke [ 12/Nov/23 ]

In the future, please try to reproduce with either CraftBukkit or Spigot as we cannot guarantee that there are no affecting changes from downstream. I will fix this though.

Comment by Floris Fiedeldij Dop [ 12/Nov/23 ]

Yep, I started noticing this coming up in my paper server when players would use an addon to grow saplings by moving. It would be applied, it seems to work, but console gets spammed like this

https://paste.md-5.net/wutoqutewi.bash

Generated at Sat Dec 13 13:38:57 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.