mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Add spacing in lectern Spigot get code
This commit is contained in:
parent
da11cd298c
commit
ad4196f5a0
1 changed files with 4 additions and 0 deletions
|
@ -187,11 +187,13 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||||
if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) {
|
if ((bukkitPlayer = Bukkit.getPlayer(session.getPlayerEntity().getUsername())) == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = bukkitPlayer.getWorld().getBlockAt(x, y, z);
|
Block block = bukkitPlayer.getWorld().getBlockAt(x, y, z);
|
||||||
if (!(block.getState() instanceof Lectern)) {
|
if (!(block.getState() instanceof Lectern)) {
|
||||||
session.getConnector().getLogger().error("Lectern expected at: " + Vector3i.from(x, y, z).toString() + " but was not! " + block.toString());
|
session.getConnector().getLogger().error("Lectern expected at: " + Vector3i.from(x, y, z).toString() + " but was not! " + block.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Lectern lectern = (Lectern) block.getState();
|
Lectern lectern = (Lectern) block.getState();
|
||||||
ItemStack itemStack = lectern.getInventory().getItem(0);
|
ItemStack itemStack = lectern.getInventory().getItem(0);
|
||||||
if (itemStack == null || !(itemStack.getItemMeta() instanceof BookMeta)) {
|
if (itemStack == null || !(itemStack.getItemMeta() instanceof BookMeta)) {
|
||||||
|
@ -202,6 +204,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||||
// We don't care; return
|
// We don't care; return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BookMeta bookMeta = (BookMeta) itemStack.getItemMeta();
|
BookMeta bookMeta = (BookMeta) itemStack.getItemMeta();
|
||||||
// On the count: allow the book to show/open even there are no pages. We know there is a book here, after all, and this matches Java behavior
|
// On the count: allow the book to show/open even there are no pages. We know there is a book here, after all, and this matches Java behavior
|
||||||
boolean hasBookPages = bookMeta.getPageCount() > 0;
|
boolean hasBookPages = bookMeta.getPageCount() > 0;
|
||||||
|
@ -226,6 +229,7 @@ public class GeyserSpigotWorldManager extends GeyserWorldManager {
|
||||||
.putString("text", "");
|
.putString("text", "");
|
||||||
pages.add(pageBuilder.build());
|
pages.add(pageBuilder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
bookTag.putCompound("tag", NbtMap.builder().putList("pages", NbtType.COMPOUND, pages).build());
|
bookTag.putCompound("tag", NbtMap.builder().putList("pages", NbtType.COMPOUND, pages).build());
|
||||||
lecternTag.putCompound("book", bookTag.build());
|
lecternTag.putCompound("book", bookTag.build());
|
||||||
NbtMap blockEntityTag = lecternTag.build();
|
NbtMap blockEntityTag = lecternTag.build();
|
||||||
|
|
Loading…
Reference in a new issue