diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/convert.java b/src/main/java/com/gamingmesh/jobs/commands/list/convert.java index 41ec8766..8830bcad 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/convert.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/convert.java @@ -70,7 +70,7 @@ public class convert implements Cmd { String from = "MysSQL"; String to = "SqLite"; - if (Jobs.getDBManager().getDbType().equals(DataBaseType.SqLite)) { + if (!Jobs.getDBManager().getDbType().equals(DataBaseType.SqLite)) { from = "SqLite"; to = "MySQL"; } diff --git a/src/main/java/com/gamingmesh/jobs/container/Convert.java b/src/main/java/com/gamingmesh/jobs/container/Convert.java index 4a7a1530..32409557 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Convert.java +++ b/src/main/java/com/gamingmesh/jobs/container/Convert.java @@ -1,16 +1,18 @@ package com.gamingmesh.jobs.container; +import java.util.UUID; + public class Convert { int id; - int userid; + UUID uuid; String jobname; int level; int exp; - public Convert(int id, int userid, String jobname, int level, int exp) { + public Convert(int id, UUID uuid, String jobname, int level, int exp) { this.id = id; - this.userid = userid; + this.uuid = uuid; this.jobname = jobname; this.level = level; this.exp = exp; @@ -23,8 +25,8 @@ public class Convert { return this.id; } - public int GetUserid() { - return this.userid; + public UUID GetUserUUID() { + return this.uuid; } public String GetJobName() { diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index 02fc750c..eb2909af 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -921,7 +921,14 @@ public abstract class JobsDAO { prest = conn.prepareStatement("SELECT * FROM `" + prefix + table + "`"); res = prest.executeQuery(); while (res.next()) { - list.add(new Convert(res.getInt("id"), res.getInt("userid"), res.getString("job"), res.getInt("level"), res.getInt("experience"))); + int id = res.getInt("userid"); + PlayerInfo pi = Jobs.getPlayerManager().getPlayerInfo(id); + if (pi == null) + continue; + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(pi.getUuid()); + if (jPlayer == null) + continue; + list.add(new Convert(res.getInt("id"), jPlayer.getPlayerUUID(), res.getString("job"), res.getInt("level"), res.getInt("experience"))); } } catch (SQLException e) { e.printStackTrace(); @@ -957,8 +964,15 @@ public abstract class JobsDAO { conns.setAutoCommit(false); while (i > 0) { i--; + + Convert convertData = list.get(i); - insert.setInt(1, convertData.GetId()); + + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(convertData.GetUserUUID()); + if (jPlayer == null) + continue; + + insert.setInt(1, jPlayer.getUserId()); insert.setString(2, convertData.GetJobName()); insert.setInt(3, convertData.GetLevel()); insert.setInt(4, convertData.GetExp());