From 061611ef306d6f413559725183f79adbc7e43615 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Wed, 4 May 2022 12:01:10 -0400 Subject: [PATCH] custom model data --- .../tylermurphy/hideAndSeek/configuration/Config.java | 10 ++++++++++ .../hideAndSeek/configuration/ConfigManager.java | 4 ++++ .../tylermurphy/hideAndSeek/configuration/Items.java | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java index c021fce..9397cc8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Config.java @@ -256,6 +256,11 @@ public class Config { ConfigurationSection item = new YamlConfiguration().createSection("temp"); item.set("name", ChatColor.translateAlternateColorCodes('&',config.getString("lobbyItems.leave.name"))); item.set("material", config.getString("lobbyItems.leave.material")); + if(Version.atLeast("1.14")){ + if(config.contains("lobbyItems.leave.model-data")){ + config.set("model-data", config.getInt("lobbyItems.leave.model-data")); + } + } List lore = config.getStringList("lobbyItems.leave.lore"); if (lore != null && !lore.isEmpty()) item.set("lore", lore); ItemStack temp = null; @@ -274,6 +279,11 @@ public class Config { lobbyStartItem = temp; lobbyItemStartAdmin = config.getBoolean("lobbyItems.start.adminOnly"); lobbyItemStartPosition = config.getInt("lobbyItems.start.position"); + if(Version.atLeast("1.14")){ + if(config.contains("lobbyItems.start.model-data")){ + config.set("model-data", config.getInt("lobbyItems.start.model-data")); + } + } } } diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java index 4b24cb9..53a30c2 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/ConfigManager.java @@ -104,6 +104,10 @@ public class ConfigManager { } } + public boolean contains(String path){ + return config.contains(path); + } + public double getDouble(String path){ double value = config.getDouble(path); if(value == 0.0D){ diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java index 1c77ec2..e42001f 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java @@ -102,6 +102,11 @@ public class Items { config.set("material", material); config.set("enchants", item.getConfigurationSection("enchantments")); config.set("unbreakable", item.getBoolean("unbreakable")); + if(Version.atLeast("1.14")){ + if(item.contains("model-data")){ + config.set("model-data", item.getInt("model-data")); + } + } if(item.isSet("lore")) config.set("lore", item.getStringList("lore")); if (material.equalsIgnoreCase("POTION") || material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION"))