Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7904

Shears Breaking in Dispensers Call PlayerItemBreakEvent and Crash the Server

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • None
    • 4317-Spigot-a759b62-f35bae9
    • N/A
    • Yes

      Created after seeing: https://www.spigotmc.org/threads/error-w-shears-in-dispenser.663686/#post-4780122

      Shears breaking when used in a dispenser cause a server crash because it calls the PlayerItemBreakEvent.

       

      [12:57:51] [Server thread/ERROR]: Encountered an unexpected exception
      net.minecraft.ReportedException: Exception ticking world
          at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:1478) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.server.dedicated.DedicatedServer.c(DedicatedServer.java:406) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1321) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1071) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
      Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.level.EntityPlayer.getBukkitEntity()" because "human" is null
          at org.bukkit.craftbukkit.v1_21_R1.event.CraftEventFactory.callPlayerItemBreakEvent(CraftEventFactory.java:1387) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.world.item.ItemStack.a(ItemStack.java:681) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.core.dispenser.DispenseBehaviorShears.a(DispenseBehaviorShears.java:69) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.core.dispenser.DispenseBehaviorItem.dispense(DispenseBehaviorItem.java:33) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.world.level.block.BlockDispenser.a(BlockDispenser.java:112) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.world.level.block.BlockDispenser.a(BlockDispenser.java:139) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.world.level.block.state.BlockBase$BlockData.a(BlockBase.java:1102) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.server.level.WorldServer.d(WorldServer.java:867) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.world.ticks.TickListServer.a(SourceFile:215) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.world.ticks.TickListServer.a(SourceFile:98) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.server.level.WorldServer.a(WorldServer.java:399) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:1472) ~[spigot-1.21.1-R0.1-SNAPSHOT.jar:4317-Spigot-a759b62-f35bae9]
          ... 5 more 

       

      Replication:

      1.  Execute the below command.

      /give @s shears[minecraft:max_damage=1]

      2. Place the received shears item into a dispenser with a sheep in front.

      3. Activate the dispenser.

       

            Doc Doc
            ItsSchatten ItsSchatten
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: