mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Make lecterns more reliable on chunk load in Spigot
This commit is contained in:
parent
6be71fc045
commit
13c924f841
1 changed files with 8 additions and 2 deletions
|
@ -182,7 +182,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
|||
@Override
|
||||
public NbtMap getLecternDataAt(GeyserSession session, int x, int y, int z, boolean isChunkLoad) {
|
||||
// Run as a task to prevent async issues
|
||||
Bukkit.getScheduler().runTask(this.plugin, () -> {
|
||||
Runnable lecternInfoGet = () -> {
|
||||
Player bukkitPlayer;
|
||||
if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) {
|
||||
return;
|
||||
|
@ -220,7 +220,13 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
|||
lecternTag.putCompound("book", bookTag.build());
|
||||
NbtMap blockEntityTag = lecternTag.build();
|
||||
BlockEntityUtils.updateBlockEntity(session, blockEntityTag, Vector3i.from(x, y, z));
|
||||
});
|
||||
};
|
||||
if (isChunkLoad) {
|
||||
// Delay to ensure the chunk is sent first, and then the lectern data
|
||||
Bukkit.getScheduler().runTaskLater(this.plugin, lecternInfoGet, 5);
|
||||
} else {
|
||||
Bukkit.getScheduler().runTask(this.plugin, lecternInfoGet);
|
||||
}
|
||||
return LecternInventoryTranslator.getBaseLecternTag(x, y, z, 0).build(); // Will be updated later
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue