MAP_CHUNK doesn't include NBT data for spawn chunk on first spawn
dordsor21 opened this issue ยท 4 comments
Make sure you've done the following:
- You're using the latest build for your server version
- This isn't an issue caused by another plugin
- You've checked for duplicate issues
- You didn't use
/reload
Debug paste link: https://pastebin.com/Jr8jKfMY
No NBT data is sent with the chunk a player spawns into on first login after a server restart. If relogging (without restarting the server) then the NBT data is sent.
I cannot for the life of me work out why this is, and am unsure as to whether or not I am doing something wrong and/or need to listen for a different Packet.
Looks like the server has the option of sending the data later with update tile entity: http://wiki.vg/Protocol#Chunk_Data
It seems that by registering the listener via TinyProtocol, I'm able to get the packet with the Sign NBT:
private TinyProtocol tinyProt;
private Reflection.FieldAccessor<List<NBTTagCompound>> thing = Reflection.getField("{nms}.PacketPlayOutMapChunk", (Class) List.class, 0);
public PlayerSignPacketListener(Main pl, ProtocolManager pM) {
tinyProt = new TinyProtocol(pl) {
@Override
public Object onPacketOutAsync(Player p, Channel channel, Object packet) {
if (thing.hasField(packet))
pl.getLogger().info(thing.get(packet).toString());
return super.onPacketOutAsync(p, channel, packet);
}
};
}
I think the issue is that the first chunk (on the first login) is sent before a lot of permissions/metadata/etc has been applied to the player (i.e. before the actual login event is fired)
I assumed that this was equivalent/the same as the MAP_CHUNK packet. Is that not the case? I'm also listening for update tile entity, and that is only sent when a sign is first created.
edit: I assume you meant to link http://wiki.vg/Protocol#Update_Block_Entity