diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-12 09:40:48 +0000 |
---|---|---|
committer | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-12-12 09:46:31 +0000 |
commit | 81db41b4d2ae94938e78bc93c7a31d3f8ef1a7b8 (patch) | |
tree | d0257a1a1ce02cea71b64d5c43bc0d7d37816c6b /src/main/java/org | |
parent | 7017af7e6d24afb09450de0bdc81acedde7323cf (diff) | |
download | craftbukkit-81db41b4d2ae94938e78bc93c7a31d3f8ef1a7b8.tar craftbukkit-81db41b4d2ae94938e78bc93c7a31d3f8ef1a7b8.tar.gz craftbukkit-81db41b4d2ae94938e78bc93c7a31d3f8ef1a7b8.tar.lz craftbukkit-81db41b4d2ae94938e78bc93c7a31d3f8ef1a7b8.tar.xz craftbukkit-81db41b4d2ae94938e78bc93c7a31d3f8ef1a7b8.zip |
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
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | 6 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java index debca310..0c69a3e7 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -78,7 +78,11 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta { for (int i = 0; i < pages.size(); i++) { String page = pages.getString(i); 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; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java index fd8ba56d..8c3d3a44 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java @@ -39,7 +39,11 @@ class CraftMetaBookSigned extends CraftMetaBook implements BookMeta { for (int i = 0; i < pages.size(); i++) { String page = pages.getString(i); 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; } |