1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-04-06 20:26:05 +02:00

Fix SQLException error when saving points

This commit is contained in:
montlikadani 2020-05-15 11:09:04 +02:00
parent fbbfe46a66
commit ebe81b6216
2 changed files with 2 additions and 11 deletions
src/main/java/com/gamingmesh/jobs

View File

@ -628,7 +628,7 @@ public class JobsPlayer {
public int getMaxJobLevelAllowed(Job job) { public int getMaxJobLevelAllowed(Job job) {
int maxLevel = 0; int maxLevel = 0;
if (getPlayer().hasPermission("jobs." + job.getName() + ".vipmaxlevel")) if (getPlayer() != null && getPlayer().hasPermission("jobs." + job.getName() + ".vipmaxlevel"))
maxLevel = job.getVipMaxLevel() > job.getMaxLevel() ? job.getVipMaxLevel() : job.getMaxLevel(); maxLevel = job.getVipMaxLevel() > job.getMaxLevel() ? job.getVipMaxLevel() : job.getMaxLevel();
else else
maxLevel = job.getMaxLevel(); maxLevel = job.getMaxLevel();
@ -795,9 +795,7 @@ public class JobsPlayer {
* @return true if online, otherwise false * @return true if online, otherwise false
*/ */
public boolean isOnline() { public boolean isOnline() {
if (getPlayer() != null) return getPlayer() != null ? getPlayer().isOnline() : isOnline;
return getPlayer().isOnline();
return isOnline;
} }
public boolean isSaved() { public boolean isSaved() {

View File

@ -1990,13 +1990,6 @@ public abstract class JobsDAO {
return; return;
PreparedStatement prest = null; PreparedStatement prest = null;
try { try {
prest = conn.prepareStatement("DELETE FROM `" + DBTables.PointsTable.getTableName() + "` WHERE `" + PointsTableFields.userid.getCollumn() + "` = ?;");
prest.setInt(1, jPlayer.getUserId());
prest.execute();
close(prest);
prest = null;
PlayerPoints pointInfo = jPlayer.getPointsData(); PlayerPoints pointInfo = jPlayer.getPointsData();
prest = conn.prepareStatement("INSERT INTO `" + DBTables.PointsTable.getTableName() + "` (`" + PointsTableFields.totalpoints.getCollumn() + "`, `" + PointsTableFields.currentpoints.getCollumn() prest = conn.prepareStatement("INSERT INTO `" + DBTables.PointsTable.getTableName() + "` (`" + PointsTableFields.totalpoints.getCollumn() + "`, `" + PointsTableFields.currentpoints.getCollumn()
+ "`, `" + PointsTableFields.userid.getCollumn() + "`) VALUES (?, ?, ?);"); + "`, `" + PointsTableFields.userid.getCollumn() + "`) VALUES (?, ?, ?);");