diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java index 22ec84b..c2d7bed 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/configuration/Items.java @@ -25,7 +25,8 @@ import org.bukkit.Material; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.*; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import java.util.ArrayList; import java.util.List; @@ -45,9 +46,9 @@ public class Items { int i = 1; while (true) { ConfigurationSection section = SeekerItems.getConfigurationSection(String.valueOf(i)); - if(section == null) break; + if (section == null) break; ItemStack item = createItem(section); - if(item != null) SEEKER_ITEMS.add(item); + if (item != null) SEEKER_ITEMS.add(item); i++; } @@ -56,9 +57,9 @@ public class Items { i = 1; while (true) { ConfigurationSection section = HiderItems.getConfigurationSection(String.valueOf(i)); - if(section == null) break; + if (section == null) break; ItemStack item = createItem(section); - if(item != null) HIDER_ITEMS.add(item); + if (item != null) HIDER_ITEMS.add(item); i++; } SEEKER_EFFECTS = new ArrayList<>(); @@ -66,9 +67,9 @@ public class Items { i = 1; while (true) { ConfigurationSection section = SeekerEffects.getConfigurationSection(String.valueOf(i)); - if(section == null) break; + if (section == null) break; PotionEffect effect = getPotionEffect(section); - if(effect != null) SEEKER_EFFECTS.add(effect); + if (effect != null) SEEKER_EFFECTS.add(effect); i++; } @@ -77,9 +78,9 @@ public class Items { i = 1; while (true) { ConfigurationSection section = HiderEffects.getConfigurationSection(String.valueOf(i)); - if(section == null) break; + if (section == null) break; PotionEffect effect = getPotionEffect(section); - if(effect != null) HIDER_EFFECTS.add(effect); + if (effect != null) HIDER_EFFECTS.add(effect); i++; } @@ -89,11 +90,11 @@ public class Items { ConfigurationSection config = new YamlConfiguration().createSection("temp"); String material = item.getString("material").toUpperCase(); boolean splash = false; - if(!Version.atLeast("1.9")){ - if(material.contains("POTION")){ + if (!Version.atLeast("1.9")) { + if (material.contains("POTION")) { config.set("level", 1); } - if(material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION")){ + if (material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION")) { material = "POTION"; splash = true; } @@ -102,25 +103,25 @@ 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")){ + 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")); if (material.equalsIgnoreCase("POTION") || material.equalsIgnoreCase("SPLASH_POTION") || material.equalsIgnoreCase("LINGERING_POTION")) config.set("base-effect", String.format("%s,%s,%s", item.getString("type"), false, splash)); ItemStack stack = XItemStack.deserialize(config); stack.setAmount(item.getInt("amount")); - if(stack.getData().getItemType() == Material.AIR) return null; + if (stack.getData().getItemType() == Material.AIR) return null; return stack; } - private static PotionEffect getPotionEffect(ConfigurationSection item){ + private static PotionEffect getPotionEffect(ConfigurationSection item) { String type = item.getString("type"); - if(type == null) return null; - if(PotionEffectType.getByName(type.toUpperCase()) == null) return null; + if (type == null) return null; + if (PotionEffectType.getByName(type.toUpperCase()) == null) return null; return new PotionEffect( Objects.requireNonNull(PotionEffectType.getByName(type.toUpperCase())), item.getInt("duration"), |