MC-Machinations / PaperTweaks

A better-performance replacement for the popular VanillaTweaks datapack collection.
GNU General Public License v3.0
141 stars 13 forks source link

Player head drops causes dupe on death on players using invalid skins #78

Open capthehacker99 opened 1 year ago

capthehacker99 commented 1 year ago

Expected behavior

The inventory not duping

Observed/Actual behavior

The inventory duped. Items dropped on ground while items still in inventory after respawn. It also produced the following error in console

[00:40:58 ERROR]: Failed to handle packet net.minecraft.network.protocol.game.PacketPlayInUseEntity@7f69b4fc, suppressing error>
java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.NBTBase.d()" because the return value of "java.util.Map$Entry.getValue()" is null
    at net.minecraft.nbt.CompoundTag.copy(CompoundTag.java:473) ~[?:?]
    at net.minecraft.world.item.ItemStack.copy(ItemStack.java:733) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.world.item.ItemStack.copy(ItemStack.java:721) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.network.syncher.EntityDataSerializers$1.copy(EntityDataSerializers.java:55) ~[?:?]
    at net.minecraft.network.syncher.EntityDataSerializers$1.copy(EntityDataSerializers.java:42) ~[?:?]
    at net.minecraft.network.syncher.SynchedEntityData$DataValue.create(SynchedEntityData.java:358) ~[?:?]
    at net.minecraft.network.syncher.SynchedEntityData$DataItem.value(SynchedEntityData.java:349) ~[?:?]
    at net.minecraft.network.syncher.SynchedEntityData.getNonDefaultValues(SynchedEntityData.java:211) ~[?:?]
    at net.minecraft.server.level.ServerEntity.<init>(ServerEntity.java:90) ~[?:?]
    at net.minecraft.server.level.ChunkMap$TrackedEntity.<init>(ChunkMap.java:1437) ~[?:?]
    at net.minecraft.server.level.ChunkMap.addEntity(ChunkMap.java:1203) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.server.level.ServerChunkCache.addEntity(ServerChunkCache.java:769) ~[?:?]
    at net.minecraft.server.level.ServerLevel$EntityCallbacks.onTrackingStart(ServerLevel.java:2714) ~[?:?]
    at net.minecraft.server.level.ServerLevel$EntityCallbacks.c(ServerLevel.java:2653) ~[?:?]
    at io.papermc.paper.chunk.system.entity.EntityLookup.entityStatusChange(EntityLookup.java:271) ~[paper-1.20.1.jar:git-Paper-50]
    at io.papermc.paper.chunk.system.entity.EntityLookup.addEntity(EntityLookup.java:394) ~[paper-1.20.1.jar:git-Paper-50]
    at io.papermc.paper.chunk.system.entity.EntityLookup.addNewEntity(EntityLookup.java:332) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.server.level.ServerLevel.addEntity(ServerLevel.java:1661) ~[?:?]
    at net.minecraft.server.level.ServerLevel.addFreshEntity(ServerLevel.java:1564) ~[?:?]
    at org.bukkit.craftbukkit.v1_20_R1.CraftWorld.dropItem(CraftWorld.java:709) ~[paper-1.20.1.jar:git-Paper-50]
    at org.bukkit.craftbukkit.v1_20_R1.CraftWorld.dropItem(CraftWorld.java:695) ~[paper-1.20.1.jar:git-Paper-50]
    at org.bukkit.craftbukkit.v1_20_R1.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:939) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.server.level.ServerPlayer.die(ServerPlayer.java:958) ~[?:?]
    at net.minecraft.world.entity.LivingEntity.hurt(LivingEntity.java:1529) ~[?:?]
    at net.minecraft.world.entity.player.Player.hurt(Player.java:967) ~[?:?]
    at net.minecraft.server.level.ServerPlayer.hurt(ServerPlayer.java:1127) ~[?:?]
    at net.minecraft.world.entity.player.Player.attack(Player.java:1320) ~[?:?]
    at net.minecraft.server.level.ServerPlayer.attack(ServerPlayer.java:2162) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl$5.a(ServerGamePacketListenerImpl.java:2875) ~[?:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket$1.dispatch(ServerboundInteractPacket.java:24) ~[?:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket.dispatch(ServerboundInteractPacket.java:80) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.handleInteract(ServerGamePacketListenerImpl.java:2799) ~[?:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:67) ~[?:?]
    at net.minecraft.network.protocol.game.ServerboundInteractPacket.handle(ServerboundInteractPacket.java:12) ~[?:?]
    at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:51) ~[?:?]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1339) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1316) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1309) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
    at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1287) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1175) ~[paper-1.20.1.jar:git-Paper-50]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-50]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

Steps/models to reproduce

Enable player head drops. Kill player with invalid skin.

Plugin and Datapack List

Plugins:

PaperTweaks

Datapacks:

[vanilla (built-in)]
[file/bukkit (world)]

Server Version Info

This server is running Paper version git-Paper-50 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: 990be16) Error obtaining version information Previous version: git-Paper-43 (MC: 1.20.1)

Plugin Version

0.3.0-SNAPSHOT

Other

The easiest way to get player with invalid skin is to set online-mode to false and make an offline player whose username doesn't exist join. I am not endorsing pirating the game in any way. This is just the most effective way to reproduce this.

1nfameArts commented 11 months ago

Does it work as expected with online-mode true?