mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-18 21:32:56 +01:00
fix: close current inventory when opening a book
This commit is contained in:
parent
7daf8d69b7
commit
e8e22a2b15
@ -995,6 +995,11 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
|
||||
@Override
|
||||
public void openBook(@NotNull Book book) {
|
||||
// Close the open inventory if there is one because the book will replace it.
|
||||
if (getOpenInventory() != null) {
|
||||
closeInventory();
|
||||
}
|
||||
|
||||
final ItemStack writtenBook = ItemStack.builder(Material.WRITTEN_BOOK)
|
||||
.meta(WrittenBookMeta.class, builder -> builder.resolved(false)
|
||||
.generation(WrittenBookMeta.WrittenBookGeneration.ORIGINAL)
|
||||
|
Loading…
Reference in New Issue
Block a user