From 72d13b30dd6d258e3c20e42af2412c1ccd1df15d Mon Sep 17 00:00:00 2001 From: Sn0wStorm Date: Tue, 30 Oct 2018 15:37:24 +0100 Subject: [PATCH] Convert Materials in old Data Files when loading in 1.13 --- src/com/dre/brewery/P.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/com/dre/brewery/P.java b/src/com/dre/brewery/P.java index 7a8eb03..26d058c 100644 --- a/src/com/dre/brewery/P.java +++ b/src/com/dre/brewery/P.java @@ -483,7 +483,17 @@ public class P extends JavaPlugin { ArrayList ingredients = new ArrayList<>(); for (String mat : matSection.getKeys(false)) { String[] matSplit = mat.split(","); - ItemStack item = new ItemStack(Material.getMaterial(matSplit[0]), matSection.getInt(mat)); + Material m = Material.getMaterial(matSplit[0]); + if (m == null && use1_13) { + if (matSplit[0].equals("LONG_GRASS")) { + m = Material.GRASS; + } else { + m = Material.matchMaterial(matSplit[0], true); + } + debugLog("converting Data Material from " + matSplit[0] + " to " + m); + } + if (m == null) continue; + ItemStack item = new ItemStack(m, matSection.getInt(mat)); if (matSplit.length == 2) { item.setDurability((short) P.p.parseInt(matSplit[1])); }