add reReadDatabase()

This commit is contained in:
fzorb 2025-07-21 08:22:04 +03:00
parent a054eb096e
commit 45c2770873

View file

@ -22,7 +22,7 @@ public final class NoThankYouMicrosoft extends JavaPlugin {
this.getServer().getPluginManager().registerEvents(new messageListener(), this); this.getServer().getPluginManager().registerEvents(new messageListener(), this);
} }
public void createDatabaseConfig() { private void createDatabaseConfig() {
databaseFile = new File(getDataFolder(), "database.yml"); databaseFile = new File(getDataFolder(), "database.yml");
if (!databaseFile.exists()) { if (!databaseFile.exists()) {
databaseFile.getParentFile().mkdirs(); databaseFile.getParentFile().mkdirs();
@ -37,6 +37,16 @@ public final class NoThankYouMicrosoft extends JavaPlugin {
} }
} }
public void reReadDatabase() {
databaseFile = new File(getDataFolder(), "database.yml");
databaseFileConfig = new YamlConfiguration();
try {
databaseFileConfig.load(databaseFile);
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
}
public static JavaPlugin getInstance() { public static JavaPlugin getInstance() {
return instance; return instance;
} }