custom model data

This commit is contained in:
Tyler Murphy 2022-05-04 12:01:10 -04:00
parent c93937df03
commit 061611ef30
3 changed files with 19 additions and 0 deletions

View file

@ -256,6 +256,11 @@ public class Config {
ConfigurationSection item = new YamlConfiguration().createSection("temp"); ConfigurationSection item = new YamlConfiguration().createSection("temp");
item.set("name", ChatColor.translateAlternateColorCodes('&',config.getString("lobbyItems.leave.name"))); item.set("name", ChatColor.translateAlternateColorCodes('&',config.getString("lobbyItems.leave.name")));
item.set("material", config.getString("lobbyItems.leave.material")); 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<String> lore = config.getStringList("lobbyItems.leave.lore"); List<String> lore = config.getStringList("lobbyItems.leave.lore");
if (lore != null && !lore.isEmpty()) item.set("lore", lore); if (lore != null && !lore.isEmpty()) item.set("lore", lore);
ItemStack temp = null; ItemStack temp = null;
@ -274,6 +279,11 @@ public class Config {
lobbyStartItem = temp; lobbyStartItem = temp;
lobbyItemStartAdmin = config.getBoolean("lobbyItems.start.adminOnly"); lobbyItemStartAdmin = config.getBoolean("lobbyItems.start.adminOnly");
lobbyItemStartPosition = config.getInt("lobbyItems.start.position"); 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"));
}
}
} }
} }

View file

@ -104,6 +104,10 @@ public class ConfigManager {
} }
} }
public boolean contains(String path){
return config.contains(path);
}
public double getDouble(String path){ public double getDouble(String path){
double value = config.getDouble(path); double value = config.getDouble(path);
if(value == 0.0D){ if(value == 0.0D){

View file

@ -102,6 +102,11 @@ public class Items {
config.set("material", material); config.set("material", material);
config.set("enchants", item.getConfigurationSection("enchantments")); config.set("enchants", item.getConfigurationSection("enchantments"));
config.set("unbreakable", item.getBoolean("unbreakable")); 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")) if(item.isSet("lore"))
config.set("lore", item.getStringList("lore")); config.set("lore", item.getStringList("lore"));
if (material.equalsIgnoreCase("POTION") || material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION")) if (material.equalsIgnoreCase("POTION") || material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION"))