mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
We don't need this ones anymore.
This commit is contained in:
parent
855cea13ef
commit
11af61064c
@ -61,7 +61,7 @@ import com.gamingmesh.jobs.economy.PointsData;
|
|||||||
import com.gamingmesh.jobs.stuff.PerformCommands;
|
import com.gamingmesh.jobs.stuff.PerformCommands;
|
||||||
|
|
||||||
public class PlayerManager {
|
public class PlayerManager {
|
||||||
// private Map<String, JobsPlayer> players = Collections.synchronizedMap(new HashMap<String, JobsPlayer>());
|
|
||||||
private ConcurrentHashMap<String, JobsPlayer> playersCache = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<String, JobsPlayer> playersCache = new ConcurrentHashMap<>();
|
||||||
private ConcurrentHashMap<UUID, JobsPlayer> playersUUIDCache = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<UUID, JobsPlayer> playersUUIDCache = new ConcurrentHashMap<>();
|
||||||
private ConcurrentHashMap<String, JobsPlayer> players = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<String, JobsPlayer> players = new ConcurrentHashMap<>();
|
||||||
@ -175,7 +175,6 @@ public class PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.addPlayer(jPlayer);
|
this.addPlayer(jPlayer);
|
||||||
jPlayer.setPlayer(player);
|
|
||||||
AutoJoinJobs(player);
|
AutoJoinJobs(player);
|
||||||
jPlayer.onConnect();
|
jPlayer.onConnect();
|
||||||
jPlayer.reloadHonorific();
|
jPlayer.reloadHonorific();
|
||||||
@ -294,7 +293,7 @@ public class PlayerManager {
|
|||||||
if (info.getName() == null)
|
if (info.getName() == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
JobsPlayer jPlayer = new JobsPlayer(info.getName(), null);
|
JobsPlayer jPlayer = new JobsPlayer(info.getName());
|
||||||
jPlayer.setPlayerUUID(info.getUuid());
|
jPlayer.setPlayerUUID(info.getUuid());
|
||||||
jPlayer.setUserId(info.getID());
|
jPlayer.setUserId(info.getID());
|
||||||
jPlayer.setDoneQuests(info.getQuestsDone());
|
jPlayer.setDoneQuests(info.getQuestsDone());
|
||||||
|
@ -26,7 +26,6 @@ import java.util.Map.Entry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
@ -58,9 +57,6 @@ public class JobsPlayer {
|
|||||||
// player online status
|
// player online status
|
||||||
private volatile boolean isOnline = false;
|
private volatile boolean isOnline = false;
|
||||||
|
|
||||||
private OfflinePlayer OffPlayer = null;
|
|
||||||
private Player player = null;
|
|
||||||
|
|
||||||
private HashMap<CurrencyType, Integer> limits = new HashMap<>();
|
private HashMap<CurrencyType, Integer> limits = new HashMap<>();
|
||||||
|
|
||||||
private int userid = -1;
|
private int userid = -1;
|
||||||
@ -81,10 +77,8 @@ public class JobsPlayer {
|
|||||||
private HashMap<String, HashMap<String, QuestProgression>> qProgression = new HashMap<>();
|
private HashMap<String, HashMap<String, QuestProgression>> qProgression = new HashMap<>();
|
||||||
private int doneQuests = 0;
|
private int doneQuests = 0;
|
||||||
|
|
||||||
public JobsPlayer(String userName, OfflinePlayer OffPlayer) {
|
public JobsPlayer(String userName) {
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.OffPlayer = OffPlayer;
|
|
||||||
this.player = Bukkit.getPlayer(userName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArchivedJobs getArchivedJobs() {
|
public ArchivedJobs getArchivedJobs() {
|
||||||
@ -148,10 +142,6 @@ public class JobsPlayer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayer(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadLogFromDao() {
|
public void loadLogFromDao() {
|
||||||
Jobs.getJobsDAO().loadLog(this);
|
Jobs.getJobsDAO().loadLog(this);
|
||||||
}
|
}
|
||||||
@ -196,14 +186,9 @@ public class JobsPlayer {
|
|||||||
*/
|
*/
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
if (this.playerUUID != null) {
|
if (this.playerUUID != null) {
|
||||||
Player p = Bukkit.getPlayer(this.playerUUID);
|
return Bukkit.getPlayer(this.playerUUID);
|
||||||
if (p != null) {
|
|
||||||
this.player = p;
|
|
||||||
this.OffPlayer = p;
|
|
||||||
this.userName = player.getName();
|
|
||||||
}
|
}
|
||||||
}
|
return null;
|
||||||
return this.player;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,7 +246,7 @@ public class JobsPlayer {
|
|||||||
v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost.all." + type.getName().toLowerCase());
|
v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost.all." + type.getName().toLowerCase());
|
||||||
if (Boost == null || v1 != null && v1 > Boost)
|
if (Boost == null || v1 != null && v1 > Boost)
|
||||||
Boost = v1;
|
Boost = v1;
|
||||||
Debug.D(Boost +" "+ JobName + " " + type);
|
Debug.D(Boost + " " + JobName + " " + type);
|
||||||
return Boost == null ? 0D : Boost;
|
return Boost == null ? 0D : Boost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,9 +317,8 @@ public class JobsPlayer {
|
|||||||
* @return true if have
|
* @return true if have
|
||||||
*/
|
*/
|
||||||
public boolean havePermission(String perm) {
|
public boolean havePermission(String perm) {
|
||||||
if (this.player == null)
|
Player player = Bukkit.getPlayer(this.getPlayerUUID());
|
||||||
this.player = Bukkit.getPlayer(this.getPlayerUUID());
|
if (player != null)
|
||||||
if (this.player != null)
|
|
||||||
return Perm.hasPermission(player, perm);
|
return Perm.hasPermission(player, perm);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -356,10 +340,9 @@ public class JobsPlayer {
|
|||||||
* @return the userName
|
* @return the userName
|
||||||
*/
|
*/
|
||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
|
Player player = Bukkit.getPlayer(this.getPlayerUUID());
|
||||||
if (player != null)
|
if (player != null)
|
||||||
userName = player.getName();
|
userName = player.getName();
|
||||||
if (userName == null && OffPlayer != null)
|
|
||||||
userName = OffPlayer.getName();
|
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,10 +351,6 @@ public class JobsPlayer {
|
|||||||
* @return the playerUUID
|
* @return the playerUUID
|
||||||
*/
|
*/
|
||||||
public UUID getPlayerUUID() {
|
public UUID getPlayerUUID() {
|
||||||
if (this.playerUUID == null && player != null)
|
|
||||||
this.playerUUID = player.getUniqueId();
|
|
||||||
if (this.playerUUID == null && this.OffPlayer != null)
|
|
||||||
this.playerUUID = OffPlayer.getUniqueId();
|
|
||||||
return this.playerUUID;
|
return this.playerUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1231,8 +1231,9 @@ public abstract class JobsDAO {
|
|||||||
|
|
||||||
public JobsPlayer loadFromDao(OfflinePlayer player) {
|
public JobsPlayer loadFromDao(OfflinePlayer player) {
|
||||||
|
|
||||||
JobsPlayer jPlayer = new JobsPlayer(player.getName(), player);
|
JobsPlayer jPlayer = new JobsPlayer(player.getName());
|
||||||
jPlayer.playerUUID = player.getUniqueId();
|
jPlayer.setPlayerUUID(player.getUniqueId());
|
||||||
|
|
||||||
List<JobsDAOData> list = getAllJobs(player);
|
List<JobsDAOData> list = getAllJobs(player);
|
||||||
// synchronized (jPlayer.saveLock) {
|
// synchronized (jPlayer.saveLock) {
|
||||||
jPlayer.progression.clear();
|
jPlayer.progression.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user