lol i forgot to add coins to player data

This commit is contained in:
spacerocket62 2020-10-27 14:30:57 -07:00
parent 5400581b3d
commit 9dfc351ebe
4 changed files with 12 additions and 3 deletions

View File

@ -50,6 +50,7 @@ public class MongoPlayerData
updateOps.set("prefix", player.getPrefix()); updateOps.set("prefix", player.getPrefix());
updateOps.set("rank", player.getRank() == null ? "" : player.getRank().name().toLowerCase()); updateOps.set("rank", player.getRank() == null ? "" : player.getRank().name().toLowerCase());
updateOps.set("ips", player.getIps()); updateOps.set("ips", player.getIps());
updateOps.set("coins", player.getCoins());
plexPlayerDAO.update(filter, updateOps); plexPlayerDAO.update(filter, updateOps);
} }

View File

@ -17,8 +17,8 @@ public class SQLPlayerData
{ {
private final String SELECT = "SELECT * FROM `players` WHERE uuid=?"; private final String SELECT = "SELECT * FROM `players` WHERE uuid=?";
private final String UPDATE = "UPDATE `players` SET name=?, login_msg=?, prefix=?, rank=?, ips=? WHERE uuid=?"; private final String UPDATE = "UPDATE `players` SET name=?, login_msg=?, prefix=?, rank=?, ips=?, coins=? WHERE uuid=?";
private final String INSERT = "INSERT INTO `players` (`uuid`, `name`, `login_msg`, `prefix`, `rank`, `ips`) VALUES (?, ?, ?, ?, ?, ?);"; private final String INSERT = "INSERT INTO `players` (`uuid`, `name`, `login_msg`, `prefix`, `rank`, `ips`, `coins`) VALUES (?, ?, ?, ?, ?, ?, ?);";
public boolean exists(UUID uuid) public boolean exists(UUID uuid)
{ {
@ -54,6 +54,7 @@ public class SQLPlayerData
String loginMSG = set.getString("login_msg"); String loginMSG = set.getString("login_msg");
String prefix = set.getString("prefix"); String prefix = set.getString("prefix");
String rankName = set.getString("rank").toUpperCase(); String rankName = set.getString("rank").toUpperCase();
long coins = set.getLong("coins");
Rank rank = Rank.valueOf(rankName); Rank rank = Rank.valueOf(rankName);
List<String> ips = new Gson().fromJson(set.getString("ips"), new TypeToken<List<String>>(){}.getType()); List<String> ips = new Gson().fromJson(set.getString("ips"), new TypeToken<List<String>>(){}.getType());
plexPlayer.setName(name); plexPlayer.setName(name);
@ -61,6 +62,7 @@ public class SQLPlayerData
plexPlayer.setPrefix(prefix); plexPlayer.setPrefix(prefix);
plexPlayer.setRank(rankName.isEmpty() ? null : rank); plexPlayer.setRank(rankName.isEmpty() ? null : rank);
plexPlayer.setIps(ips); plexPlayer.setIps(ips);
plexPlayer.setCoins(coins);
} }
return plexPlayer; return plexPlayer;
} }
@ -80,7 +82,8 @@ public class SQLPlayerData
statement.setString(3, player.getPrefix()); statement.setString(3, player.getPrefix());
statement.setString(4, player.getRank() == null ? "" : player.getRank().name().toLowerCase()); statement.setString(4, player.getRank() == null ? "" : player.getRank().name().toLowerCase());
statement.setString(5, new Gson().toJson(player.getIps())); statement.setString(5, new Gson().toJson(player.getIps()));
statement.setString(6, player.getUuid()); statement.setLong(6, player.getCoins());
statement.setString(7, player.getUuid());
statement.executeUpdate(); statement.executeUpdate();
} }
catch (SQLException throwables) { catch (SQLException throwables) {

View File

@ -33,6 +33,8 @@ public class PlexPlayer
private String loginMSG; private String loginMSG;
private String prefix; private String prefix;
private long coins;
private Rank rank; private Rank rank;
private List<String> ips; private List<String> ips;
@ -50,6 +52,8 @@ public class PlexPlayer
this.loginMSG = ""; this.loginMSG = "";
this.prefix = ""; this.prefix = "";
this.coins = 0;
this.ips = new ArrayList<>(); this.ips = new ArrayList<>();
this.rank = null; this.rank = null;

View File

@ -44,6 +44,7 @@ public class SQLConnection
"\t`prefix` VARCHAR(30),\n" + "\t`prefix` VARCHAR(30),\n" +
"\t`rank` VARCHAR(256),\n" + "\t`rank` VARCHAR(256),\n" +
"\t`ips` VARCHAR(65535),\n" + "\t`ips` VARCHAR(65535),\n" +
"\t`coins` BIGINT,\n" +
"\tPRIMARY KEY (`uuid`)\n" + "\tPRIMARY KEY (`uuid`)\n" +
");").execute(); ");").execute();
} catch (SQLException throwables) { } catch (SQLException throwables) {