1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 12:05:16 +01:00
This commit is contained in:
Zrips 2019-08-14 15:23:03 +03:00
commit 91da45d6cf
4 changed files with 16 additions and 58 deletions

View File

@ -104,24 +104,28 @@ public class PlayerManager {
}
public void addPlayerToCache(JobsPlayer jPlayer) {
if (jPlayer.getUserName() != null)
if (jPlayer.getUserName() != null && playersCache.get(jPlayer.getUserName().toLowerCase()) == null)
playersCache.put(jPlayer.getUserName().toLowerCase(), jPlayer);
if (jPlayer.getPlayerUUID() != null)
if (jPlayer.getPlayerUUID() != null && playersUUIDCache.get(jPlayer.getPlayerUUID()) == null)
playersUUIDCache.put(jPlayer.getPlayerUUID(), jPlayer);
}
public void addPlayer(JobsPlayer jPlayer) {
if (jPlayer.getUserName() != null)
if (jPlayer.getUserName() != null && players.get(jPlayer.getUserName().toLowerCase()) == null)
players.put(jPlayer.getUserName().toLowerCase(), jPlayer);
if (jPlayer.getPlayerUUID() != null)
if (jPlayer.getPlayerUUID() != null && playersUUID.get(jPlayer.getPlayerUUID()) == null)
playersUUID.put(jPlayer.getPlayerUUID(), jPlayer);
}
public JobsPlayer removePlayer(Player player) {
if (player == null)
return null;
players.remove(player.getName().toLowerCase());
JobsPlayer jPlayer = playersUUID.remove(player.getUniqueId());
if (players.get(player.getName()) != null)
players.remove(player.getName().toLowerCase());
JobsPlayer jPlayer = playersUUID.get(player.getUniqueId()) != null ?
playersUUID.remove(player.getUniqueId()) : null;
return jPlayer;
}
@ -197,6 +201,7 @@ public class PlayerManager {
JobsPlayer jPlayer = getJobsPlayer(player);
if (jPlayer == null)
return;
if (Jobs.getGCManager().saveOnDisconnect()) {
jPlayer.onDisconnect();
jPlayer.save();

View File

@ -23,7 +23,6 @@ import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
import com.gamingmesh.jobs.config.CommentedYamlConfiguration;
import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.Debug;
public class SignUtil {
@ -99,9 +98,9 @@ public class SignUtil {
jobsSign newTemp = new jobsSign();
if (NameSection.isString("World")) {
newTemp.setWorldName(NameSection.getString("World"));
newTemp.setX((int) NameSection.getDouble("X"));
newTemp.setY((int) NameSection.getDouble("Y"));
newTemp.setZ((int) NameSection.getDouble("Z"));
newTemp.getLocation().setX((int) NameSection.getDouble("X"));
newTemp.getLocation().setY((int) NameSection.getDouble("Y"));
newTemp.getLocation().setZ((int) NameSection.getDouble("Z"));
} else {
newTemp.setLoc(NameSection.getString("Loc"));
}
@ -233,6 +232,8 @@ public class SignUtil {
temp.put(SignJobName, PlayerList);
}
break;
default:
break;
}
if (PlayerList.isEmpty())

View File

@ -44,30 +44,6 @@ public class jobsSign {
return worldName;
}
public void setX(int x) {
this.x = x;
}
public double getX() {
return x;
}
public void setY(int y) {
this.y = y;
}
public double getY() {
return y;
}
public void setZ(int z) {
this.z = z;
}
public double getZ() {
return z;
}
public Location getLocation() {
if (loc != null)
return loc;

View File

@ -24,30 +24,6 @@ public class blockLoc {
worldName = loc.getWorld().getName();
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
public String getWorldName() {
return worldName;
}