mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-31 21:37:57 +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 to = "SqLite";
|
||||
|
||||
if (Jobs.getDBManager().getDbType().equals(DataBaseType.SqLite)) {
|
||||
if (!Jobs.getDBManager().getDbType().equals(DataBaseType.SqLite)) {
|
||||
from = "SqLite";
|
||||
to = "MySQL";
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user