Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Plugin: remove useless isOldVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFaser committed Sep 2, 2023
1 parent 342dbed commit d997183
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/main/java/net/flectone/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public final class Main extends JavaPlugin implements Listener {
private static CustomThreadPool dataThreadPool;
private Database database;

public static boolean isOldVersion = false;

public static Main getInstance() {
return instance;
}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/flectone/managers/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public static void initialize() {
String version = Main.getInstance().getDescription().getVersion();

if (!version.equals(config.getString("version"))) {
Main.isOldVersion = true;
Main.warning("⚠ Your configs have been updated to " + version);

config.set("version", version);
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/net/flectone/sqlite/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
import java.util.stream.Collectors;

public abstract class Database {
private static boolean migrate3_9_0 = false;

public static void setMigrate3_9_0(boolean migrate3_9_0) {
Database.migrate3_9_0 = migrate3_9_0;
}

final Main plugin;
protected static Connection connection;

Expand All @@ -42,7 +48,7 @@ public void initialize() {
PreparedStatement ps = connection.prepareStatement("SELECT * FROM players WHERE uuid = ?");
ps.executeQuery();

if (Main.isOldVersion) migrateDatabase3_9_0();
if (migrate3_9_0) migrateDatabase3_9_0();

} catch (SQLException ex) {
plugin.getLogger().log(Level.SEVERE, "Unable to retrieve connection", ex);
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/net/flectone/sqlite/SQLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,8 @@ public void load() {

ResultSet rs = md.getColumns(null, null, "players", "mute_time");
if (rs.next()) {
Main.isOldVersion = true;
}
setMigrate3_9_0(true);

if (Main.isOldVersion) {
File oldFile = new File(plugin.getDataFolder(), dbname + ".db");
File newFile = new File(plugin.getDataFolder(), dbname + "-old.db");
newFile.createNewFile();
Expand Down

0 comments on commit d997183

Please sign in to comment.