1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-02 23:43:44 +01:00

change version only if update checks are correct

This commit is contained in:
Zrips 2016-03-10 14:48:15 +02:00
parent d2299bfe03
commit 3f4f113891
3 changed files with 90 additions and 100 deletions

View File

@ -34,7 +34,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.JobsPlugin;
import com.gamingmesh.jobs.config.ConfigManager; import com.gamingmesh.jobs.config.ConfigManager;
import com.gamingmesh.jobs.container.Convert; import com.gamingmesh.jobs.container.Convert;
import com.gamingmesh.jobs.container.ExploreChunk; import com.gamingmesh.jobs.container.ExploreChunk;
@ -63,11 +62,6 @@ public abstract class JobsDAO {
private JobsConnectionPool pool; private JobsConnectionPool pool;
private String prefix; private String prefix;
private JobsPlugin plugin;
public JobsDAO(JobsPlugin plugin) {
this.plugin = plugin;
}
protected JobsDAO(String driverName, String url, String username, String password, String prefix) { protected JobsDAO(String driverName, String url, String username, String password, String prefix) {
this.prefix = prefix; this.prefix = prefix;
@ -105,8 +99,8 @@ public abstract class JobsDAO {
checkUpdate8(); checkUpdate8();
version = 8; version = 8;
} finally {
updateSchemaVersion(version); updateSchemaVersion(version);
} finally {
} }
} }
@ -505,9 +499,6 @@ public abstract class JobsDAO {
} }
public void fixUuid(final CommandSender sender) { public void fixUuid(final CommandSender sender) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
JobsConnection conn = getConnection(); JobsConnection conn = getConnection();
if (conn == null) if (conn == null)
return; return;
@ -547,14 +538,8 @@ public abstract class JobsDAO {
return; return;
} }
});
return;
}
public void fixName(final CommandSender sender) { public void fixName(final CommandSender sender) {
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
JobsConnection conn = getConnection(); JobsConnection conn = getConnection();
if (conn == null) if (conn == null)
return; return;
@ -608,10 +593,6 @@ public abstract class JobsDAO {
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
return;
}
});
return; return;
} }

View File

@ -350,7 +350,12 @@ public class JobsDAOMySQL extends JobsDAO {
PreparedStatement insert = null; PreparedStatement insert = null;
while (rs.next()) { while (rs.next()) {
String uuid = UUIDUtil.fromBytes(rs.getBytes("player_uuid")).toString(); byte[] uuidBytes = rs.getBytes("player_uuid");
if (uuidBytes == null)
continue;
String uuid = UUIDUtil.fromBytes(uuidBytes).toString();
if (uuid != null) { if (uuid != null) {
insert = conn.prepareStatement("INSERT INTO `" + getPrefix() insert = conn.prepareStatement("INSERT INTO `" + getPrefix()

View File

@ -328,8 +328,12 @@ public class JobsDAOSQLite extends JobsDAO {
ResultSet rs = pst1.executeQuery(); ResultSet rs = pst1.executeQuery();
PreparedStatement insert = null; PreparedStatement insert = null;
while (rs.next()) { while (rs.next()) {
byte[] uuidBytes = rs.getBytes("player_uuid");
String uuid = UUIDUtil.fromBytes(rs.getBytes("player_uuid")).toString(); if (uuidBytes == null)
continue;
String uuid = UUIDUtil.fromBytes(uuidBytes).toString();
if (uuid != null) { if (uuid != null) {
insert = conn.prepareStatement("INSERT INTO `" + getPrefix() insert = conn.prepareStatement("INSERT INTO `" + getPrefix()