mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-09 19:48:13 +01:00
Doing some refactoring
This commit is contained in:
parent
9ba5a2bfb8
commit
e998161c5c
@ -80,8 +80,10 @@ public void execute(@NotNull CommandSender commandSender, @NotNull String mainCo
|
|||||||
messageStart.send(sender);
|
messageStart.send(sender);
|
||||||
|
|
||||||
File debugFile = new File(plugin.getDataFolder(), "debug.txt");
|
File debugFile = new File(plugin.getDataFolder(), "debug.txt");
|
||||||
if(debugFile.exists()) //noinspection ResultOfMethodCallIgnored
|
if(debugFile.exists() && !debugFile.delete())
|
||||||
debugFile.delete();
|
{
|
||||||
|
plugin.getLogger().warning("Unable to delete debug.txt file!");
|
||||||
|
}
|
||||||
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(debugFile), StandardCharsets.UTF_8));
|
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(debugFile), StandardCharsets.UTF_8));
|
||||||
|
|
||||||
writer.append(plugin.getDescription().getName()).append(" Version: ").append(plugin.getDescription().getVersion());
|
writer.append(plugin.getDescription().getName()).append(" Version: ").append(plugin.getDescription().getVersion());
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
package at.pcgamingfreaks.Minepacks.Bukkit.Database;
|
package at.pcgamingfreaks.Minepacks.Bukkit.Database;
|
||||||
|
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.OldFileUpdater;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Database.Helper.OldFileUpdater;
|
||||||
|
import at.pcgamingfreaks.Version;
|
||||||
import at.pcgamingfreaks.YamlFileManager;
|
import at.pcgamingfreaks.YamlFileManager;
|
||||||
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -28,7 +29,7 @@
|
|||||||
|
|
||||||
public class Language extends at.pcgamingfreaks.Bukkit.Language
|
public class Language extends at.pcgamingfreaks.Bukkit.Language
|
||||||
{
|
{
|
||||||
private static final int LANG_VERSION = 19, UPGRADE_THRESHOLD = LANG_VERSION;
|
private static final Version LANG_VERSION = new Version(19), UPGRADE_THRESHOLD = LANG_VERSION;
|
||||||
|
|
||||||
public Language(JavaPlugin plugin)
|
public Language(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,10 @@ protected ToSQLMigration(@NotNull Minepacks plugin, @NotNull Database oldDb, @No
|
|||||||
case "mysql": newDb = new MySQL(plugin, connectionProvider); break;
|
case "mysql": newDb = new MySQL(plugin, connectionProvider); break;
|
||||||
case "sqlite":
|
case "sqlite":
|
||||||
final File dbFile = new File(SQLite.getDbFile(plugin));
|
final File dbFile = new File(SQLite.getDbFile(plugin));
|
||||||
if(dbFile.exists()) dbFile.renameTo(new File(SQLite.getDbFile(plugin) + ".old_" + System.currentTimeMillis()));
|
if(dbFile.exists() && !dbFile.renameTo(new File(SQLite.getDbFile(plugin) + ".old_" + System.currentTimeMillis())))
|
||||||
|
{
|
||||||
|
plugin.getLogger().warning("Failed to rename old database file.");
|
||||||
|
}
|
||||||
newDb = new SQLite(plugin, connectionProvider);
|
newDb = new SQLite(plugin, connectionProvider);
|
||||||
break;
|
break;
|
||||||
default: newDb = null;
|
default: newDb = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user