下面列出了怎么用org.bukkit.inventory.meta.BookMeta的API类实例代码及写法,或者点击链接到github查看源代码。
public static void handleEditBookEvent(EntityPlayerMP player, ItemStack newBookItem) {
int itemInHandIndex = player.inventory.currentItem;
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), player.inventory.currentItem, (BookMeta) CraftItemStack.getItemMeta(player.inventory.getCurrentItem()), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == Items.WRITTEN_BOOK);
player.world.getServer().getPluginManager().callEvent(editBookEvent);
ItemStack itemInHand = player.inventory.getStackInSlot(itemInHandIndex);
// If they've got the same item in their hand, it'll need to be updated.
if (itemInHand != null && itemInHand.getItem() == Items.WRITABLE_BOOK) {
if (!editBookEvent.isCancelled()) {
if (editBookEvent.isSigning()) {
itemInHand.setItem(Items.WRITTEN_BOOK);
}
CraftMetaBook meta = (CraftMetaBook) editBookEvent.getNewBookMeta();
List<ITextComponent> pages = meta.pages;
for (int i = 0; i < pages.size(); i++) {
pages.set(i, stripEvents(pages.get(i)));
}
CraftItemStack.setItemMeta(itemInHand, meta);
}
// Client will have updated its idea of the book item; we need to overwrite that
Slot slot = player.openContainer.getSlotFromInventory(player.inventory, itemInHandIndex);
player.connection.sendPacket(new SPacketSetSlot(player.openContainer.windowId, slot.slotNumber, itemInHand));
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onLecternInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!isOnPipe(player)) return;
Block block = event.getClickedBlock();
if (block == null || block.getType() != Material.LECTERN) return;
Lectern lectern = (Lectern) block.getState();
ItemStack book = lectern.getInventory().getItem(0);
if (book == null) return;
BookMeta meta = (BookMeta) book.getItemMeta();
// Open a book with the text of the lectern's writable book
ItemStack newBook = new ItemStack(Material.WRITTEN_BOOK);
BookMeta newBookMeta = (BookMeta) newBook.getItemMeta();
newBookMeta.setPages(meta.getPages());
newBookMeta.setAuthor("an upsidedown person");
newBookMeta.setTitle("buk");
newBook.setItemMeta(newBookMeta);
player.openBook(newBook);
event.setCancelled(true);
}
public CustomBookOverlay(String title, String author, TellRawMessage... pages) {
this.book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) this.book.getItemMeta();
meta.setTitle(title);
meta.setAuthor(author);
for (TellRawMessage page: pages) {
try {
addPage(meta, page);
} catch (Exception e) {
e.printStackTrace();
}
}
this.book.setItemMeta(meta);
}
@SubCommand(value = "setbookauthor", permission = "nu.setbook")
public void setbookauthor(CommandSender sender, Arguments args) {
if (!(args.length() > 1)) {
msg(sender, "manual.setbookauthor.usage");
return;
}
String author = args.next();
Player p = asPlayer(sender);
author = ChatColor.translateAlternateColorCodes('&', author);
ItemStack item = p.getInventory().getItemInMainHand();
if (item == null || !item.getType().equals(Material.WRITTEN_BOOK)) {
msg(sender, "user.setbook.no_book");
return;
}
BookMeta meta = (BookMeta) item.getItemMeta();
meta.setAuthor(author);
item.setItemMeta(meta);
msg(sender, "user.setbook.success");
}
@SubCommand(value = "setbooktitle", permission = "nu.setbook")
public void setbooktitle(CommandSender sender, Arguments args) {
if (!(args.length() > 1)) {
msg(sender, "manual.setbooktitle.usage");
return;
}
String title = args.next();
Player p = asPlayer(sender);
title = ChatColor.translateAlternateColorCodes('&', title);
ItemStack item = p.getInventory().getItemInMainHand();
if (item == null || !item.getType().equals(Material.WRITTEN_BOOK)) {
msg(sender, "user.setbook.no_book");
return;
}
BookMeta meta = (BookMeta) item.getItemMeta();
meta.setTitle(title);
item.setItemMeta(meta);
msg(sender, "user.setbook.success");
}
@SubCommand(value = "setbookunsigned", permission = "nu.setbook")
public void setbookunsigned(CommandSender sender, Arguments args) {
Player p = asPlayer(sender);
ItemStack item = p.getInventory().getItemInMainHand();
if (item == null || !item.getType().equals(Material.WRITTEN_BOOK)) {
msg(sender, "user.setbook.no_book");
return;
}
BookMeta meta = (BookMeta) item.getItemMeta();
ItemStack newbook = new ItemStack(Material.WRITABLE_BOOK, 1);
BookMeta newbookMeta = (BookMeta) newbook.getItemMeta();
newbookMeta.setPages(meta.getPages());
newbook.setItemMeta(newbookMeta);
p.getInventory().setItemInMainHand(newbook);
msg(sender, "user.setbook.success");
}
public static void handleEditBookEvent(net.minecraft.entity.player.EntityPlayerMP player, net.minecraft.item.ItemStack newBookItem) {
int itemInHandIndex = player.inventory.currentItem;
PlayerEditBookEvent editBookEvent = new PlayerEditBookEvent(player.getBukkitEntity(), player.inventory.currentItem, (BookMeta) CraftItemStack.getItemMeta(player.inventory.getCurrentItem()), (BookMeta) CraftItemStack.getItemMeta(newBookItem), newBookItem.getItem() == net.minecraft.init.Items.written_book);
player.worldObj.getServer().getPluginManager().callEvent(editBookEvent);
net.minecraft.item.ItemStack itemInHand = player.inventory.getStackInSlot(itemInHandIndex);
// If they've got the same item in their hand, it'll need to be updated.
if (itemInHand != null && itemInHand.getItem() == net.minecraft.init.Items.writable_book) {
if (!editBookEvent.isCancelled()) {
CraftItemStack.setItemMeta(itemInHand, editBookEvent.getNewBookMeta());
if (editBookEvent.isSigning()) {
itemInHand.func_150996_a(net.minecraft.init.Items.written_book);
}
}
// Client will have updated its idea of the book item; we need to overwrite that
net.minecraft.inventory.Slot slot = player.openContainer.getSlotFromInventory((net.minecraft.inventory.IInventory) player.inventory, itemInHandIndex);
player.playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S2FPacketSetSlot(player.openContainer.windowId, slot.slotNumber, itemInHand));
}
}
public static void paginate(BookMeta meta, String longString) {
/* Break page into lines and pass into longString. */
int count = 0;
ArrayList<String> lines = new ArrayList<String>();
String line = "";
for (char c : longString.toCharArray()) {
count++;
if (c == '\n' || count > CHARS_PER_LINE) {
lines.add(line);
line = "";
count = 0;
}
if (c != '\n') {
line += c;
}
}
linePageinate(meta, lines);
}
public static void linePageinate(BookMeta meta, ArrayList<String> lines) {
/*
* 13 writeable lines per page, iterate through each line
* and place into the page, when the line count equals 14
* set it back to 0 and add page.
*/
int count = 0;
String page = "";
for (String line : lines) {
count++;
if (count > LINES_PER_PAGE) {
meta.addPage(page);
count = 0;
page = "";
}
page += line+"\n";
}
meta.addPage(page);
}
public static String loadData(BookMeta meta, String dataTitle) {
int pageCount = meta.getPageCount();
if (pageCount == 0) {
return null;
}
StringBuilder dataSB = new StringBuilder();
for (int i = 1; i <= pageCount; ++i) {
String page = meta.getPage(i);
if (page.startsWith(dataTitle)) {
dataSB.append(page.substring(dataTitle.length() + _dataPre.length()));
for (++i; i <= pageCount; ++i) {
page = meta.getPage(i);
if (page.startsWith(_dataPre)) {
dataSB.append(page.substring(_dataPre.length()));
} else {
break;
}
}
return dataSB.toString();
}
}
return null;
}
protected void applyConfig(ConfigurationSection section) {
_enabled = section.getBoolean("enabled");
_name = section.getString("name");
ItemMeta meta = _item.getItemMeta();
if (meta instanceof BookMeta) {
((BookMeta) meta).setTitle(_name);
} else {
meta.setDisplayName(_name);
}
meta.setLore(section.getStringList("lore"));
_item.setItemMeta(meta);
List<String> allowedWorlds = section.getStringList("allowed-worlds");
if (allowedWorlds == null || allowedWorlds.size() == 0) {
List<String> blockedWorlds = section.getStringList("blocked-worlds");
_blockedWorlds = (blockedWorlds.size() > 0 ? new HashSet<String>(blockedWorlds) : null);
_allowedWorlds = null;
} else {
_allowedWorlds = new HashSet<String>(allowedWorlds);
}
}
private int getBookLength(final ExploitPlayer exploitPlayer, final HamsterPlayer hamsterPlayer,
final ItemMeta itemMeta) {
final Player player = hamsterPlayer.getPlayer();
final Logger logger = plugin.getLogger();
final BookMeta bookMeta = (BookMeta) itemMeta;
final double dataVls = packetsModule.getDataVls();
final int pageCount = bookMeta.getPageCount(), dataBytesBook = packetsModule.getDataBytesBook();
int bookTotalBytes = 0;
if (pageCount > 50) {
if (notificationsModule.isDebug()) {
logger.info(player.getName() + " has sent a packet with a book with too many pages! (" + pageCount + "/"
+ 50 + ") Added vls: " + dataVls);
}
exploitPlayer.addVls(plugin, null, hamsterPlayer, packetsModule, dataVls);
} else {
for (final String page : bookMeta.getPages()) {
final int pageBytes = page.getBytes(StandardCharsets.UTF_8).length;
bookTotalBytes += pageBytes;
if (pageBytes > dataBytesBook) {
if (notificationsModule.isDebug()) {
logger.info(
player.getName() + " has sent a packet with a book with too many characters per page! ("
+ pageBytes + "/" + dataBytesBook + ") Added vls: " + dataVls);
}
exploitPlayer.addVls(plugin, null, hamsterPlayer, packetsModule, dataVls);
break;
}
}
return bookTotalBytes;
}
return itemMeta.toString().getBytes(StandardCharsets.UTF_8).length;
}
public ItemStack parseBook(Element el) throws InvalidXMLException {
ItemStack itemStack = parseItem(el, Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) itemStack.getItemMeta();
meta.setTitle(BukkitUtils.colorize(XMLUtils.getRequiredUniqueChild(el, "title").getText()));
meta.setAuthor(BukkitUtils.colorize(XMLUtils.getRequiredUniqueChild(el, "author").getText()));
Element elPages = el.getChild("pages");
if (elPages != null) {
for (Element elPage : elPages.getChildren("page")) {
String text = elPage.getText();
text = text.trim(); // Remove leading and trailing whitespace
text =
Pattern.compile("^[ \\t]+", Pattern.MULTILINE)
.matcher(text)
.replaceAll(""); // Remove indentation on each line
text =
Pattern.compile("^\\n", Pattern.MULTILINE)
.matcher(text)
.replaceAll(
" \n"); // Add a space to blank lines, otherwise they vanish for unknown reasons
text = BukkitUtils.colorize(text); // Color codes
meta.addPage(text);
}
}
itemStack.setItemMeta(meta);
return itemStack;
}
public void sendBook(MatchPlayer viewer, boolean forceOpen) {
String title = ChatColor.GOLD + "" + ChatColor.BOLD;
title += TextTranslations.translate("vote.title.map", viewer.getBukkit());
ItemStack is = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) is.getItemMeta();
meta.setAuthor("PGM");
meta.setTitle(title);
TextComponent.Builder content = TextComponent.builder();
content.append(TranslatableComponent.of("vote.header.map", TextColor.DARK_PURPLE));
content.append(TextComponent.of("\n\n"));
for (MapInfo pgmMap : votes.keySet()) content.append(getMapBookComponent(viewer, pgmMap));
NMSHacks.setBookPages(
meta, TextTranslations.toBaseComponent(content.build(), viewer.getBukkit()));
is.setItemMeta(meta);
ItemStack held = viewer.getInventory().getItemInHand();
if (held.getType() != Material.WRITTEN_BOOK
|| !title.equals(((BookMeta) is.getItemMeta()).getTitle())) {
viewer.getInventory().setHeldItemSlot(2);
}
viewer.getInventory().setItemInHand(is);
if (forceOpen || viewer.getSettings().getValue(SettingKey.VOTE) == SettingValue.VOTE_ON)
NMSHacks.openBook(is, viewer.getBukkit());
}
public PlayerEditBookEvent(Player who, int slot, BookMeta previousBookMeta, BookMeta newBookMeta, boolean isSigning) {
super(who);
Validate.isTrue(slot >= 0 && slot <= 8, "Slot must be in range 0-8 inclusive");
Validate.notNull(previousBookMeta, "Previous book meta must not be null");
Validate.notNull(newBookMeta, "New book meta must not be null");
Bukkit.getItemFactory().equals(previousBookMeta, newBookMeta);
this.previousBookMeta = previousBookMeta;
this.newBookMeta = newBookMeta;
this.slot = slot;
this.isSigning = isSigning;
this.cancel = false;
}
@Override
public String getName(Player player, ItemStack itemStack) {
if (itemStack == null) {
return "-";
}
ItemMeta itemMeta = itemStack.getItemMeta();
if (itemMeta instanceof BookMeta && ((BookMeta) itemMeta).getTitle() != null) {
return ((BookMeta) itemMeta).getTitle();
}
if (!Version.isAfter(Version.v1_11)) {
if (itemStack.getType().name().equals("MONSTER_EGG")) {
NBTCompound nbtCompound = NMS.handle().loadNBT(itemStack);
if (nbtCompound.containsKey("EntityTag")) {
return lang.getString("item_monsterPlacer_name") + " " + lang.getString("entity_" + nbtCompound.get("EntityTag").asCompound().get("id").asString() + "_name");
}
return lang.getString("item_monsterPlacer_name");
}
} else if (!Version.isAfter(Version.v1_13)) {
if (itemMeta instanceof SpawnEggMeta) {
String spawnEggType = lang.getString("entity_" + ((SpawnEggMeta) itemMeta).getSpawnedType().getEntityClass().getSimpleName().replace(".", "_") + "_name");
if (spawnEggType != null) {
return lang.getString(NMS.handle().getName(itemStack).replace(".", "_"), itemStack.getType().name().toLowerCase().replace("_", "")) + " " + spawnEggType;
}
}
}
return lang.getString(NMS.handle().getName(itemStack).replace(".", "_"), itemStack.getType().name().toLowerCase().replace("_", ""));
}
@Override
public void addPages(BookMeta bookmeta, BaseComponent[]... pages) {
for (BaseComponent[] components : pages) {
if (v11600) {
((org.bukkit.craftbukkit.v1_16_R1.inventory.CraftMetaBook) bookmeta).pages.add(net.minecraft.server.v1_16_R1.IChatBaseComponent.ChatSerializer.a(ComponentSerializer.toString(components)));
} else {
((CraftMetaBook) bookmeta).pages.add(IChatBaseComponent.ChatSerializer.a(ComponentSerializer.toString(components)));
}
}
}
/**
* Creates a new instance of the BookBuilder from an ItemStack representing the book item
* @param book the book's ItemStack
*/
public BookBuilder(ItemStack book, String title, String author) {
this.book = book;
this.meta = (BookMeta)book.getItemMeta();
this.meta.setTitle(title);
this.meta.setAuthor(author);
}
@Override
public void run(Player player, String[] args) {
BookFormatter.writtenBook()
.generation(BookMeta.Generation.COPY_OF_COPY)
.addPage(TellrawJson.create()
.append("BookBuilder")
.hoverText("HoverText"))
.open(player);
}
public static ItemStack generateBook(String title, String author, List<String> pages) {
ItemStack stack = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) factory.getItemMeta(Material.WRITTEN_BOOK);
meta.setTitle(title);
meta.setAuthor(author);
meta.setPages(pages);
stack.setItemMeta(meta);
return stack;
}
@Nullable
@Override
public String convert(ItemType item) {
if (!book.isOfType(item.getMaterial()))
return null;
return ((BookMeta) item.getItemMeta()).getAuthor();
}
private boolean allowBook(ItemStack item) {
if (item != null && item.hasItemMeta() && item.getItemMeta() instanceof BookMeta) {
System.out.println("[Crazy Auctions] Checking " + item.getType() + " for illegal unicode.");
try {
Files.TEST_FILE.getFile().set("Test", item);
Files.TEST_FILE.saveFile();
System.out.println("[Crazy Auctions] " + item.getType() + " has passed unicode checks.");
} catch (YAMLException e) {
System.out.println("[Crazy Auctions] " + item.getType() + " has failed unicode checks and has been denied.");
return false;
}
return ((BookMeta) item.getItemMeta()).getPages().stream().mapToInt(String :: length).sum() < 2000;
}
return true;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private void addPage(BookMeta meta, TellRawMessage page) throws Exception {
Field field = ReflectionUtils.getField(ReflectionUtils.getClass(PackageName.OBC, "inventory.CraftMetaBook"), "pages");
field.setAccessible(true);
List pages = (List) field.get(meta);
pages.add(ReflectionUtils.getClass(PackageName.NMS, "IChatBaseComponent").cast(page.getSerializedString()));
field.setAccessible(false);
}
/**
* Check if two items are similar to each other
* @param itemStack1 The first item
* @param itemStack2 The second item
* @return {@code true} if the given items are similar or {@code false} if not
*/
public static boolean isItemSimilar(ItemStack itemStack1, ItemStack itemStack2) {
if (itemStack1 == null || itemStack2 == null) {
return false;
}
ItemMeta itemMeta1 = itemStack1.getItemMeta();
ItemMeta itemMeta2 = itemStack2.getItemMeta();
if (itemMeta1 instanceof BookMeta && itemMeta2 instanceof BookMeta) {
BookMeta bookMeta1 = (BookMeta) itemStack1.getItemMeta();
BookMeta bookMeta2 = (BookMeta) itemStack2.getItemMeta();
if ((getMajorVersion() == 9 && getRevision() == 1) || getMajorVersion() == 8) {
CustomBookMeta.Generation generation1 = CustomBookMeta.getGeneration(itemStack1);
CustomBookMeta.Generation generation2 = CustomBookMeta.getGeneration(itemStack2);
if (generation1 == null) CustomBookMeta.setGeneration(itemStack1, CustomBookMeta.Generation.ORIGINAL);
if (generation2 == null) CustomBookMeta.setGeneration(itemStack2, CustomBookMeta.Generation.ORIGINAL);
} else {
if (bookMeta1.getGeneration() == null) bookMeta1.setGeneration(BookMeta.Generation.ORIGINAL);
if (bookMeta2.getGeneration() == null) bookMeta2.setGeneration(BookMeta.Generation.ORIGINAL);
}
itemStack1.setItemMeta(bookMeta1);
itemStack2.setItemMeta(bookMeta2);
itemStack1 = decode(encode(itemStack1));
itemStack2 = decode(encode(itemStack2));
}
return itemStack1.isSimilar(itemStack2);
}
/**
* Checks if the item is journal
*
* @param playerID ID of the player
* @param item ItemStack to check against being the journal
* @return true if the ItemStack is the journal, false otherwise
*/
public static boolean isJournal(String playerID, ItemStack item) {
// if there is no item then it's not a journal
if (item == null) {
return false;
}
// get language
String playerLang = BetonQuest.getInstance().getPlayerData(playerID).getLanguage();
// check all properties of the item and return the result
return (item.getType().equals(Material.WRITTEN_BOOK) && ((BookMeta) item.getItemMeta()).hasTitle()
&& ((BookMeta) item.getItemMeta()).getTitle().equals(Config.getMessage(playerLang, "journal_title"))
&& item.getItemMeta().hasLore()
&& item.getItemMeta().getLore().contains(Config.getMessage(playerLang, "journal_lore")));
}
@Override
public void onPlayerDeath(EntityDeathEvent event, ItemStack stack) {
Player player = (Player)event.getEntity();
Resident resident = CivGlobal.getResident(player);
if (resident == null || !resident.hasTown()) {
return;
}
ArrayList<String> bookout = MissionLogger.getMissionLogs(resident.getTown());
ItemStack book = new ItemStack(Material.WRITTEN_BOOK, 1);
BookMeta meta = (BookMeta) book.getItemMeta();
ArrayList<String> lore = new ArrayList<String>();
lore.add("Mission Report");
meta.setAuthor("Mission Reports");
meta.setTitle("Missions From "+resident.getTown().getName());
String out = "";
for (String str : bookout) {
out += str+"\n";
}
BookUtil.paginate(meta, out);
meta.setLore(lore);
book.setItemMeta(meta);
player.getWorld().dropItem(player.getLocation(), book);
}
@SuppressWarnings("deprecation")
private Item getItem(ItemStack is, Byte slot) {
byte count = (byte) is.getAmount();
short damage = (short) is.getData().getData();
short itemid = (short) is.getTypeId();
ItemTag itemtag = null;
if (is.hasItemMeta()) {
List<Ench> enchants = null;
ItemMeta im = is.getItemMeta();
Map<Enchantment, Integer> isEnchants = im.getEnchants();
if (isEnchants != null) {
enchants = new ArrayList<>();
for (Enchantment ench : isEnchants.keySet()) {
enchants.add(new Ench((short) ench.getId(), isEnchants.get(ench).shortValue()));
}
}
List<String> lore = im.getLore();
String name = im.getDisplayName();
Display display = new Display(name, lore);
String author = null;
String title = null;
List<String> pages = null;
if (im instanceof BookMeta) {
BookMeta bm = (BookMeta) im;
author = bm.getAuthor();
title = bm.getTitle();
pages = bm.getPages();
}
itemtag = new ItemTag(0, enchants, display, author, title, pages);
}
return new Item(count, slot, damage, itemid, itemtag);
}
@SuppressWarnings("deprecation")
private void setTag(ItemStack is, ItemTag itemtag) {
List<Ench> enchants = itemtag.getEnchants();
//Integer repaircost = itemtag.getRepairCost();
List<String> pages = itemtag.getPages();
String author = itemtag.getAuthor();
String title = itemtag.getTitle();
Display display = itemtag.getDisplay();
ItemMeta itemmeta = is.getItemMeta();
if (display != null) {
List<String> lores = display.getLore();
String name = display.getName();
itemmeta.setLore(lores);
itemmeta.setDisplayName(name);
}
if (itemmeta instanceof BookMeta) {
BookMeta bookmeta = (BookMeta) itemmeta;
bookmeta.setAuthor(author);
bookmeta.setTitle(title);
bookmeta.setPages(pages);
}
if (itemmeta instanceof EnchantmentStorageMeta) {
EnchantmentStorageMeta enchantmentstoragemeta = (EnchantmentStorageMeta) itemmeta;
for (Ench enchant : enchants) {
enchantmentstoragemeta.addEnchant(Enchantment.getById(enchant.getId()), enchant.getLvl(), true);
}
}
is.setItemMeta(itemmeta);
}
public static ItemStack createBook(Material material, int amount, String name, String author) {
ItemStack item = createItem(material, amount, (short) 0, name);
BookMeta meta = (BookMeta) item.getItemMeta();
meta.setAuthor(author);
meta.setPages(Collections.singletonList(""));
item.setItemMeta(meta);
return item;
}
public static EntityNBT bookToEntityNBT(ItemStack book) {
if (isValidBook(book)) {
try {
String data = BookSerialize.loadData((BookMeta) book.getItemMeta(), _dataTitle);
if (data == null) {
// This is not a BoS v0.2, is BoS v0.1?
data = BookSerialize.loadData((BookMeta) book.getItemMeta(), _dataTitleOLD);
if (data != null) {
// Yes, it is v0.1, do a dirty conversion.
int i = data.indexOf(',');
NBTTagCompound nbtData = NBTTagCompound.unserialize(Base64.decode(data.substring(i + 1)));
nbtData.setString("id", data.substring(0, i));
data = Base64.encodeBytes(nbtData.serialize(), Base64.GZIP);
}
}
if (data != null) {
if (data.startsWith("§k")) {
// Dirty fix, for some reason 'data' can sometimes start with §k.
// Remove it!!!
data = data.substring(2);
}
return EntityNBT.unserialize(data);
}
} catch (Exception e) {
_plugin.getLogger().log(Level.WARNING, "Corrupt Book of Souls.", e);
return null;
}
}
return null;
}