ProtocolLib

3M Downloads

No field with type I exists in PacketPlayOutEntityDestroy

ThianFrietpan opened this issue ยท 2 comments

commented

My bug
When using /vanish, my vanish plugin sends an Entity Destroy packet. I've used an integer array with the Entity ID in it, but ProtocolLib can't find the field. Propably a bug in ProtocolLib. I'm using Paper 1.18.1.

Console Error
[21:54:02 ERROR]: null org.bukkit.command.CommandException: Unhandled exception executing command 'v' in plugin UltraVanish v1.0-SNAPSHOT at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchCommand(CraftServer.java:897) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleCommand(ServerGamePacketListenerImpl.java:2268) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2079) ~[?:?] at net.minecraft.server.network.ServerGamePacketListenerImpl.handleChat(ServerGamePacketListenerImpl.java:2060) ~[?:?] at net.minecraft.network.protocol.game.ServerboundChatPacket.handle(ServerboundChatPacket.java:46) ~[?:?] at net.minecraft.network.protocol.game.ServerboundChatPacket.a(ServerboundChatPacket.java:6) ~[?:?] at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$1(PacketUtils.java:56) ~[?:?] at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:149) ~[?:?] at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:23) ~[?:?] at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1413) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:189) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:122) ~[?:?] at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1391) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1384) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.util.thread.BlockableEventLoop.runAllTasks(BlockableEventLoop.java:110) ~[?:?] at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1518) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.18.1.jar:git-Paper-97] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-97] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: com.comphenix.protocol.reflect.FieldAccessException: No field with type [I exists in class PacketPlayOutEntityDestroy. at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:365) ~[ProtocolLib.jar:?] at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:345) ~[ProtocolLib.jar:?] at me.thianfrietpan.ultravanish.spigot.SpigotAPI.sendEntityDestroyPacket(SpigotAPI.java:212) ~[UltraVanish.jar:?] at me.thianfrietpan.ultravanish.spigot.SpigotAPI.hidePlayer(SpigotAPI.java:140) ~[UltraVanish.jar:?] at me.thianfrietpan.ultravanish.spigot.commands.VanishCommand.lambda$new$0(VanishCommand.java:33) ~[UltraVanish.jar:?] at me.thianfrietpan.panapi.CommandLibV4.CustomCommand.lambda$register$0(CustomCommand.java:123) ~[PanCore 1.17.jar:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?] ... 21 more

My Code
private void sendEntityDestroyPacket(final Player receiver, final Player vanishedPlayer) { <<-- line 206 in class SpigotAPI
if (!ProtocolLibrary.getProtocolManager().getEntityTrackers(vanishedPlayer).contains(receiver)) {
return;
}
final PacketContainer packetContainer = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
int[] ids = { vanishedPlayer.getEntityId() };
packetContainer.getIntegerArrays().write(0, ids); <<-- line 212
try {
ProtocolLibrary.getProtocolManager().sendServerPacket(receiver, packetContainer);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}

I hope you are able to fix it or send me the mistake that I'm making.

Kind regards,

ThianFrietpan

commented

Use getIntLists instead of getIntArrays. The field type changed in 1.18 (again) :)

commented

I'll try that. Thank you for your response!