geforkt von Mirrors/Paper
19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
30 Zeilen
1.3 KiB
Diff
30 Zeilen
1.3 KiB
Diff
From 682010b58ea10a2eba83b13250f030a3658ea702 Mon Sep 17 00:00:00 2001
|
|
From: Thinkofdeath <thinkofdeath@spigotmc.org>
|
|
Date: Tue, 19 Aug 2014 11:04:21 +0100
|
|
Subject: [PATCH] Skip invalid enchants in CraftMetaItem
|
|
|
|
Its a rare case but when loading a world from a modded server which added enchantments
|
|
CraftMetaItem would add a null enchantment into the enchantment map which causes
|
|
NullPointers later
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
index 18d7c96..799b148 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
@@ -432,7 +432,11 @@ class CraftMetaItem implements ItemMeta, Repairable {
|
|
int id = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_ID.NBT);
|
|
int level = 0xffff & ((NBTTagCompound) ench.get(i)).getShort(ENCHANTMENTS_LVL.NBT);
|
|
|
|
- enchantments.put(Enchantment.getById(id), level);
|
|
+ // Spigot start - skip invalid enchantments
|
|
+ Enchantment e = Enchantment.getById(id);
|
|
+ if (e == null) continue;
|
|
+ // Spigot end
|
|
+ enchantments.put(e, level);
|
|
}
|
|
|
|
return enchantments;
|
|
--
|
|
2.1.0
|
|
|