mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Recording player database ID at moment we got to avoid duplicates
This commit is contained in:
parent
7a07869131
commit
6643a456e5
@ -63,7 +63,6 @@ import com.gamingmesh.jobs.stuff.Util;
|
|||||||
|
|
||||||
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
import net.Zrips.CMILib.ActionBar.CMIActionBar;
|
||||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
|
||||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||||
import net.Zrips.CMILib.NBT.CMINBT;
|
import net.Zrips.CMILib.NBT.CMINBT;
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
@ -284,6 +283,8 @@ public class PlayerManager {
|
|||||||
jPlayer.onConnect();
|
jPlayer.onConnect();
|
||||||
jPlayer.reloadHonorific();
|
jPlayer.reloadHonorific();
|
||||||
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
||||||
|
|
||||||
|
addPlayerToCache(jPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
@ -92,6 +93,16 @@ public class JobsPlayer {
|
|||||||
|
|
||||||
private PlayerPoints pointsData = new PlayerPoints();
|
private PlayerPoints pointsData = new PlayerPoints();
|
||||||
|
|
||||||
|
public JobsPlayer(OfflinePlayer player) {
|
||||||
|
this.userName = player.getName() == null ? "Unknown" : player.getName();
|
||||||
|
this.playerUUID = player.getUniqueId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public JobsPlayer(Player player) {
|
||||||
|
this.userName = player.getName() == null ? "Unknown" : player.getName();
|
||||||
|
this.playerUUID = player.getUniqueId();
|
||||||
|
}
|
||||||
|
|
||||||
public JobsPlayer(String userName) {
|
public JobsPlayer(String userName) {
|
||||||
this.userName = userName == null ? "Unknown" : userName;
|
this.userName = userName == null ? "Unknown" : userName;
|
||||||
}
|
}
|
||||||
@ -1368,7 +1379,7 @@ public class JobsPlayer {
|
|||||||
|
|
||||||
String perm = "jobs.max" + (type == BlockTypes.FURNACE
|
String perm = "jobs.max" + (type == BlockTypes.FURNACE
|
||||||
? "furnaces" : type == BlockTypes.BLAST_FURNACE ? "blastfurnaces" : type == BlockTypes.SMOKER ? "smokers"
|
? "furnaces" : type == BlockTypes.BLAST_FURNACE ? "blastfurnaces" : type == BlockTypes.SMOKER ? "smokers"
|
||||||
: type == BlockTypes.BREWING_STAND ? "brewingstands" : "");
|
: type == BlockTypes.BREWING_STAND ? "brewingstands" : "");
|
||||||
|
|
||||||
maxV = Jobs.getPermissionManager().getMaxPermission(this, perm);
|
maxV = Jobs.getPermissionManager().getMaxPermission(this, perm);
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ public class PlayerInfo {
|
|||||||
this.questsDone = questsDone;
|
this.questsDone = questsDone;
|
||||||
this.questProgression = questProgression;
|
this.questProgression = questProgression;
|
||||||
player = Jobs.getPlayerManager().getJobsPlayer(uuid);
|
player = Jobs.getPlayerManager().getJobsPlayer(uuid);
|
||||||
|
if (player != null)
|
||||||
|
player.setUserId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerInfo(String name, int id, UUID uuid, Long seen, Integer questsDone) {
|
public PlayerInfo(String name, int id, UUID uuid, Long seen, Integer questsDone) {
|
||||||
|
@ -914,8 +914,7 @@ public abstract class JobsDAO {
|
|||||||
|
|
||||||
res2 = prestt.getGeneratedKeys();
|
res2 = prestt.getGeneratedKeys();
|
||||||
|
|
||||||
Jobs.getPlayerManager().addPlayerToMap(new PlayerInfo(playerName, res2.next() ? res2.getInt(1) : 0,
|
Jobs.getPlayerManager().addPlayerToMap(new PlayerInfo(playerName, res2.next() ? res2.getInt(1) : 0, uuid, System.currentTimeMillis(), 0));
|
||||||
uuid, System.currentTimeMillis(), 0));
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
@ -1845,8 +1844,7 @@ public abstract class JobsDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public JobsPlayer loadFromDao(OfflinePlayer player) {
|
public JobsPlayer loadFromDao(OfflinePlayer player) {
|
||||||
JobsPlayer jPlayer = new JobsPlayer(player.getName());
|
JobsPlayer jPlayer = new JobsPlayer(player);
|
||||||
jPlayer.setPlayerUUID(player.getUniqueId());
|
|
||||||
return loadFromDao(jPlayer);
|
return loadFromDao(jPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user