mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-12 13:43:57 +01:00
Support Unbreakable NBT tag for items loaded from hand, fixes #591
This commit is contained in:
parent
fe92c86584
commit
c07e361ec7
@ -247,6 +247,16 @@ public class ItemUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
extra.put(key, nested);
|
extra.put(key, nested);
|
||||||
|
} else if (value.equals("true")) {
|
||||||
|
// For some NBT tags
|
||||||
|
try {
|
||||||
|
if (key.equalsIgnoreCase("unbreakable")) {
|
||||||
|
meta.setUnbreakable(true);
|
||||||
|
}
|
||||||
|
} catch (Throwable tr) {
|
||||||
|
Bukkit.getLogger().info("You are running a version of CraftBukkit"
|
||||||
|
+ " for which Quests cannot set the NBT tag " + key);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
extra.put(key, value);
|
extra.put(key, value);
|
||||||
}
|
}
|
||||||
@ -260,7 +270,11 @@ public class ItemUtil {
|
|||||||
}
|
}
|
||||||
meta = stack.getItemMeta();
|
meta = stack.getItemMeta();
|
||||||
if (!extra.isEmpty()) {
|
if (!extra.isEmpty()) {
|
||||||
meta = ItemUtil.deserializeItemMeta(meta.getClass(), (Map<String, Object>) extra);
|
ItemMeta toLoad = null;
|
||||||
|
toLoad = ItemUtil.deserializeItemMeta(meta.getClass(), (Map<String, Object>) extra);
|
||||||
|
if (toLoad != null) {
|
||||||
|
meta = toLoad;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!enchs.isEmpty()) {
|
if (!enchs.isEmpty()) {
|
||||||
for (Enchantment e : enchs.keySet()) {
|
for (Enchantment e : enchs.keySet()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user