mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-05 15:57:47 +01:00
Couple fixes for conversion
This commit is contained in:
parent
8eed14b765
commit
59e258734b
@ -70,7 +70,7 @@ public class convert implements Cmd {
|
|||||||
String from = "MysSQL";
|
String from = "MysSQL";
|
||||||
String to = "SqLite";
|
String to = "SqLite";
|
||||||
|
|
||||||
if (Jobs.getDBManager().getDbType().equals(DataBaseType.SqLite)) {
|
if (!Jobs.getDBManager().getDbType().equals(DataBaseType.SqLite)) {
|
||||||
from = "SqLite";
|
from = "SqLite";
|
||||||
to = "MySQL";
|
to = "MySQL";
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
package com.gamingmesh.jobs.container;
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Convert {
|
public class Convert {
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
int userid;
|
UUID uuid;
|
||||||
String jobname;
|
String jobname;
|
||||||
int level;
|
int level;
|
||||||
int exp;
|
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.id = id;
|
||||||
this.userid = userid;
|
this.uuid = uuid;
|
||||||
this.jobname = jobname;
|
this.jobname = jobname;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.exp = exp;
|
this.exp = exp;
|
||||||
@ -23,8 +25,8 @@ public class Convert {
|
|||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetUserid() {
|
public UUID GetUserUUID() {
|
||||||
return this.userid;
|
return this.uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String GetJobName() {
|
public String GetJobName() {
|
||||||
|
@ -921,7 +921,14 @@ public abstract class JobsDAO {
|
|||||||
prest = conn.prepareStatement("SELECT * FROM `" + prefix + table + "`");
|
prest = conn.prepareStatement("SELECT * FROM `" + prefix + table + "`");
|
||||||
res = prest.executeQuery();
|
res = prest.executeQuery();
|
||||||
while (res.next()) {
|
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) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -957,8 +964,15 @@ public abstract class JobsDAO {
|
|||||||
conns.setAutoCommit(false);
|
conns.setAutoCommit(false);
|
||||||
while (i > 0) {
|
while (i > 0) {
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
|
|
||||||
Convert convertData = list.get(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.setString(2, convertData.GetJobName());
|
||||||
insert.setInt(3, convertData.GetLevel());
|
insert.setInt(3, convertData.GetLevel());
|
||||||
insert.setInt(4, convertData.GetExp());
|
insert.setInt(4, convertData.GetExp());
|
||||||
|
Loading…
Reference in New Issue
Block a user