13
0
geforkt von Mirrors/Paper

Ignore errors when parsing books and treat them as old books

In previous versions there was a mistake with book handled which
may leave books in a broken state, this tries to handle that

By: Thinkofdeath <thinkofdeath@spigotmc.org>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2014-12-12 09:40:48 +00:00
Ursprung 130ed6bfe6
Commit 63d1f2368e
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -78,7 +78,11 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta {
for (int i = 0; i < pages.size(); i++) { for (int i = 0; i < pages.size(); i++) {
String page = pages.getString(i); String page = pages.getString(i);
if (resolved) { if (resolved) {
page = CraftChatMessage.fromComponent(ChatSerializer.a(page)); try {
page = CraftChatMessage.fromComponent(ChatSerializer.a(page));
} catch (Exception e) {
// Ignore and treat as an old book
}
} }
pageArray[i] = page; pageArray[i] = page;
} }

Datei anzeigen

@ -39,7 +39,11 @@ class CraftMetaBookSigned extends CraftMetaBook implements BookMeta {
for (int i = 0; i < pages.size(); i++) { for (int i = 0; i < pages.size(); i++) {
String page = pages.getString(i); String page = pages.getString(i);
if (resolved) { if (resolved) {
page = CraftChatMessage.fromComponent(ChatSerializer.a(page)); try {
page = CraftChatMessage.fromComponent(ChatSerializer.a(page));
} catch (Exception e) {
// Ignore and treat as an old book
}
} }
pageArray[i] = page; pageArray[i] = page;
} }