SeanOMik / TamableFoxes

SpigotMC Plugin that gives you the ability to tame foxes!
MIT License
27 stars 17 forks source link

If you kill a fox you will be kicked out #90

Closed friedumple closed 1 year ago

friedumple commented 1 year ago

Version : TamableFoxes_v2.2.7 Server : paper-1.19.2.jar:git-Paper-307

TamableFoxes [21:25:55 ERROR]: Error whilst processing packet net.minecraft.network.protocol.game.PacketPlayInUseEntity@2f9ce762 for FrieDumpl_TW[/127.0.0.1:52618] java.lang.NullPointerException: Cannot invoke "net.minecraft.world.entity.EntityLiving.co()" because the return value of "net.seanomik.tamablefoxes.versions.version_1_19_2_R1.EntityTamableFox.getOwner()" is null at net.seanomik.tamablefoxes.versions.version_1_19_2_R1.EntityTamableFox.a(EntityTamableFox.java:574) ~[TamableFoxes_v2.2.7-SNAPSHOT.jar:?] at net.minecraft.world.entity.LivingEntity.hurt(LivingEntity.java:1490) ~[?:?] at net.minecraft.world.entity.player.Player.attack(Player.java:1331) ~[?:?] at net.minecraft.server.level.ServerPlayer.attack(ServerPlayer.java:2095) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl$5.a(ServerGamePacketListenerImpl.java:2985) ~[?:?] 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:2906) ~[?:?] 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$1(PacketUtils.java:51) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-307] 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:1341) ~[paper-1.19.2.jar:git-Paper-307] at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-307] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-307] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-307] at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:114) ~[?:?] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1445) ~[paper-1.19.2.jar:git-Paper-307] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1173) ~[paper-1.19.2.jar:git-Paper-307] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-307] at java.lang.Thread.run(Thread.java:833) ~[?:?]

Kauo7420 commented 1 year ago

This code is an error log of a Minecraft server, which contains a NullPointerException. The reason for the exception is that in the line of code net.seanomik.tamablefoxes.versions.version_1_19_2_R1.EntityTamableFox.a(EntityTamableFox.java:574), the method net.minecraft.world.entity.EntityLiving.co() is called, but the method net.seanomik.tamablefoxes.versions.version_1_19_2_R1.EntityTamableFox.getOwner() returns null, resulting in a NullPointerException.

The purpose of this code is to attack an entity, but the entity being attacked is a tamable fox, and the attacker is not the owner of the fox, so a NullPointerException occurs during the attack.

I am not the plugin author, I can only explain the problems that appear in the log, I hope this can help you.

SeanOMik commented 1 year ago

@friedumple This was a bug that occurred when updating the plugin. It's fixed in the latest version.