1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-29 05:55:27 +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) { 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); playersCache.put(jPlayer.getUserName().toLowerCase(), jPlayer);
if (jPlayer.getPlayerUUID() != null) if (jPlayer.getPlayerUUID() != null && playersUUIDCache.get(jPlayer.getPlayerUUID()) == null)
playersUUIDCache.put(jPlayer.getPlayerUUID(), jPlayer); playersUUIDCache.put(jPlayer.getPlayerUUID(), jPlayer);
} }
public void addPlayer(JobsPlayer 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); players.put(jPlayer.getUserName().toLowerCase(), jPlayer);
if (jPlayer.getPlayerUUID() != null) if (jPlayer.getPlayerUUID() != null && playersUUID.get(jPlayer.getPlayerUUID()) == null)
playersUUID.put(jPlayer.getPlayerUUID(), jPlayer); playersUUID.put(jPlayer.getPlayerUUID(), jPlayer);
} }
public JobsPlayer removePlayer(Player player) { public JobsPlayer removePlayer(Player player) {
if (player == null) if (player == null)
return null; return null;
if (players.get(player.getName()) != null)
players.remove(player.getName().toLowerCase()); players.remove(player.getName().toLowerCase());
JobsPlayer jPlayer = playersUUID.remove(player.getUniqueId());
JobsPlayer jPlayer = playersUUID.get(player.getUniqueId()) != null ?
playersUUID.remove(player.getUniqueId()) : null;
return jPlayer; return jPlayer;
} }
@ -197,6 +201,7 @@ public class PlayerManager {
JobsPlayer jPlayer = getJobsPlayer(player); JobsPlayer jPlayer = getJobsPlayer(player);
if (jPlayer == null) if (jPlayer == null)
return; return;
if (Jobs.getGCManager().saveOnDisconnect()) { if (Jobs.getGCManager().saveOnDisconnect()) {
jPlayer.onDisconnect(); jPlayer.onDisconnect();
jPlayer.save(); 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.config.CommentedYamlConfiguration;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.TopList; import com.gamingmesh.jobs.container.TopList;
import com.gamingmesh.jobs.stuff.Debug;
public class SignUtil { public class SignUtil {
@ -99,9 +98,9 @@ public class SignUtil {
jobsSign newTemp = new jobsSign(); jobsSign newTemp = new jobsSign();
if (NameSection.isString("World")) { if (NameSection.isString("World")) {
newTemp.setWorldName(NameSection.getString("World")); newTemp.setWorldName(NameSection.getString("World"));
newTemp.setX((int) NameSection.getDouble("X")); newTemp.getLocation().setX((int) NameSection.getDouble("X"));
newTemp.setY((int) NameSection.getDouble("Y")); newTemp.getLocation().setY((int) NameSection.getDouble("Y"));
newTemp.setZ((int) NameSection.getDouble("Z")); newTemp.getLocation().setZ((int) NameSection.getDouble("Z"));
} else { } else {
newTemp.setLoc(NameSection.getString("Loc")); newTemp.setLoc(NameSection.getString("Loc"));
} }
@ -233,6 +232,8 @@ public class SignUtil {
temp.put(SignJobName, PlayerList); temp.put(SignJobName, PlayerList);
} }
break; break;
default:
break;
} }
if (PlayerList.isEmpty()) if (PlayerList.isEmpty())

View File

@ -44,30 +44,6 @@ public class jobsSign {
return worldName; 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() { public Location getLocation() {
if (loc != null) if (loc != null)
return loc; return loc;

View File

@ -24,30 +24,6 @@ public class blockLoc {
worldName = loc.getWorld().getName(); 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() { public String getWorldName() {
return worldName; return worldName;
} }