Update BookBuilder

This commit is contained in:
sky 2020-03-24 20:15:25 +08:00
parent e685221014
commit 6f63102ec5
2 changed files with 8 additions and 0 deletions

View File

@ -80,6 +80,7 @@ public class TInjectLoader implements TabooLibLoader.Loader {
config.listener(() -> {
try {
method.invoke(instance);
} catch (NullPointerException ignored) {
} catch (Throwable t) {
t.printStackTrace();
}

View File

@ -1,7 +1,9 @@
package io.izzel.taboolib.util.book.builder;
import io.izzel.taboolib.module.tellraw.TellrawJson;
import io.izzel.taboolib.util.book.BookAsm;
import io.izzel.taboolib.util.chat.BaseComponent;
import io.izzel.taboolib.util.chat.ComponentSerializer;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
@ -106,6 +108,11 @@ public class BookBuilder {
BookAsm.getHandle().setPages(meta, pages.toArray(new BaseComponent[0][]));
return this;
}
public BookBuilder addPage(TellrawJson json) {
addPages(ComponentSerializer.parse(json.toRawMessage()));
return this;
}
/**
* Append the pages of the book