Code: public class configAllowed { private static Plugin plugin; private configAllowed(Plugin plugin) { this.plugin = plugin;} private static File allow; private static FileConfiguration allows; public static void setup() { allow = new File(Bukkit.getServer().getPluginManager().getPlugin("Plugin").getDataFolder(), "allowed_items.yml"); if (!allow.exists()) { plugin.saveResource("allowed_items",false);} allows = YamlConfiguration.loadConfiguration(allow); try { allows.save(allow);} catch (IOException e) { e.printStackTrace();} } public static void save() { try { allows.save(allow);} catch (IOException e) { System.out.println("&cerror");} } public static void reload() { allows = YamlConfiguration.loadConfiguration(allow);} public static FileConfiguration get() { return allows;} } public void onEnable() { getServer().getConsoleSender().sendMessage("was enabled"); config() } public void onDisable() { getServer().getConsoleSender().sendMessage("was disabled");} public void config() { configAllowed.setup();configAllowed.get().options().copyDefaults(true);configAllowed.save();} error: https://pastebin.com/LrYCHGxY if i write Plugin plugin = new Plugin() instead this.plugin=plugin i get a another error
Your error is not coming from the file you provided but from wherever you are trying to re-initialize plugin. Plugin (the main class, extends JavaPlugin, contains onEnable) cannot be instantiated as it is already instantiated by Bukkit.
Side note: Please format your code lol. It's painful to look at. Ex. Code:java return allows;} // wat // also no indentation??public class configAllowed { private static Plugin plugin; private configAllowed(Plugin plugin) {this.plugin = plugin;}private static File allow; private static FileConfiguration allows; public static void setup() {allow = new File(Bukkit.getServer().getPluginManager().getPlugin("Plugin").getDataFolder(), "allowed_items.yml"); if (!allow.exists()) {plugin.saveResource("allowed_items",false);}allows = YamlConfiguration.loadConfiguration(allow); try {allows.save(allow);} catch (IOException e) {e.printStackTrace();}}