From 64badad14871436c61c98545ae91ae19c7835ca7 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Sun, 16 Jun 2019 15:14:06 +0200 Subject: [PATCH] Fix crash when using mysql without UUIDs --- pom.xml | 2 +- resources/config.yml | 2 +- .../Minepacks/Bukkit/Command/ReloadCommand.java | 5 ++--- .../pcgamingfreaks/Minepacks/Bukkit/Database/Database.java | 2 +- src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 43af45c..456127e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 at.pcgamingfreaks Minepacks - 2.0.3 + 2.0.4 scm:git:git@github.com:GeorgH93/Minepacks.git diff --git a/resources/config.yml b/resources/config.yml index 90b81e2..ae3a737 100644 --- a/resources/config.yml +++ b/resources/config.yml @@ -60,7 +60,7 @@ Database: # Defines the max amount of days backpacks will be stored. -1 to disable auto cleanup MaxInactiveDays: -1 # If you would like to use UUIDs, it is recommended not to change this setting unless you know what you are doing! - # true: Only to use if your server is running in online mode and your minecraft version is 1.7.5 or newer + # true: Should be used if your server is running Minecraft 1.7.5 or newer # false: In offline mode or for minecraft version below 1.7.5 # If you are using BungeeCord please set this setting based on your BungeeCord's online mode!!! UseUUIDs: true diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java index 28470c5..9e984f1 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ReloadCommand.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 GeorgH93 + * Copyright (C) 2019 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,12 +24,11 @@ import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; -import java.util.Collection; import java.util.List; public class ReloadCommand extends MinepacksCommand { - private Message messageReloading, messageReloaded; + private final Message messageReloading, messageReloaded; public ReloadCommand(Minepacks plugin) { diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java index 4d09d23..e0fa15d 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/Database.java @@ -66,7 +66,7 @@ public Database(Minepacks mp) maxAge = plugin.getConfiguration().getAutoCleanupMaxInactiveDays(); unCacheStrategie = bungeeCordMode ? new OnDisconnect(this) : UnCacheStrategie.getUnCacheStrategie(this); backupFolder = new File(this.plugin.getDataFolder(), "backups"); - if(!backupFolder.exists()) backupFolder.mkdirs(); + if(!backupFolder.exists() && backupFolder.mkdirs()) mp.getLogger().info("Failed to create backups folder."); } public void init() diff --git a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java index 8058333..cbddb5c 100644 --- a/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java +++ b/src/at/pcgamingfreaks/Minepacks/Bukkit/Database/MySQL.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016-2018 GeorgH93 + * Copyright (C) 2019 GeorgH93 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ protected void checkDB() else { DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TablePlayers} (\n{FieldPlayerID} INT UNSIGNED NOT NULL AUTO_INCREMENT,\n{FieldName} CHAR(16) NOT NULL,\n" + - "\nPRIMARY KEY ({FieldPlayerID}),\nUNIQUE INDEX {FieldUUID}_UNIQUE ({FieldUUID})\n);")); + "\nPRIMARY KEY ({FieldPlayerID})\n);")); } DBTools.updateDB(connection, replacePlaceholders("CREATE TABLE IF NOT EXISTS {TableBackpacks} (\n{FieldBPOwner} INT UNSIGNED NOT NULL,\n{FieldBPITS} BLOB,\n{FieldBPVersion} INT DEFAULT 0,\n" + "{FieldBPLastUpdate} TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n" +