package net.t2code.autoresponse.Spigot.config.response; import net.t2code.autoresponse.Util; import net.t2code.autoresponse.Spigot.objects.ResponsesObject; import net.t2code.autoresponse.Spigot.Main; import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; public class SelectResponses { private static String Prefix = Util.getPrefix(); public static void onSelect() { Main.allResponses.clear(); Main.allResponse.clear(); File f = new File(Main.getPath() + "/Responses/"); File[] fileArray = f.listFiles(); for (File config_gui : fileArray) { String sub = config_gui.getName().substring(config_gui.getName().length() - 4); if (sub.equals(".yml")) { YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config_gui); ResponsesObject response = new ResponsesObject( yamlConfiguration.getBoolean("Response.Enable"), yamlConfiguration.getStringList("Response.ResponseKeys"), yamlConfiguration.getBoolean("Response.Contains"), yamlConfiguration.getBoolean("Response.Permission.Necessary"), yamlConfiguration.getString("Response.Permission.Permission"), yamlConfiguration.getBoolean("Response.Command.Enable"), yamlConfiguration.getBoolean("Response.Command.CommandAsConsole"), yamlConfiguration.getBoolean("Response.Command.BungeeCommand"), yamlConfiguration.getStringList("Response.Command.Commands"), yamlConfiguration.getBoolean("Response.Message.Enable"), yamlConfiguration.getStringList("Response.Message.Messages"), yamlConfiguration.getBoolean("Response.Message.TextBuilder.Enable"), yamlConfiguration.getString("Response.Message.TextBuilder.Hover"), yamlConfiguration.getBoolean("Response.Message.TextBuilder.ClickEvent.Enable"), yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.Action"), yamlConfiguration.getString("Response.Message.TextBuilder.ClickEvent.ActionValue"), yamlConfiguration.getBoolean("Response.Protection.GameMode.Enable"), yamlConfiguration.getString("Response.Protection.GameMode.Mode"), yamlConfiguration.getStringList("Response.Protection.GameMode.List"), yamlConfiguration.getBoolean("Response.Protection.World.Enable"), yamlConfiguration.getString("Response.Protection.World.Mode"), yamlConfiguration.getStringList("Response.Protection.World.List")); Main.allResponses.add(response); Main.allResponse.addAll(yamlConfiguration.getStringList("Response.ResponseKeys")); } } } }