mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 04:25:15 +01:00
Use iterraation to prevent concurrent modification error
This commit is contained in:
parent
0870a3abe2
commit
1af4c554b3
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
@ -468,7 +469,9 @@ public class Jobs extends JavaPlugin {
|
||||
int y = 0;
|
||||
int total = Jobs.getPlayerManager().getMapSize();
|
||||
long time = System.currentTimeMillis();
|
||||
for (Entry<UUID, PlayerInfo> one : Jobs.getPlayerManager().getPlayersInfoUUIDMap().entrySet()) {
|
||||
Iterator<Entry<UUID, PlayerInfo>> it = Jobs.getPlayerManager().getPlayersInfoUUIDMap().entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<UUID, PlayerInfo> one = it.next();
|
||||
if (!running)
|
||||
return;
|
||||
try {
|
||||
|
@ -629,7 +629,6 @@ public class PlayerManager {
|
||||
}
|
||||
|
||||
public BoostMultiplier getBoost(JobsPlayer player, Job job, boolean force) {
|
||||
Debug.D("getting boost");
|
||||
BoostMultiplier b = new BoostMultiplier();
|
||||
for (CurrencyType one : CurrencyType.values()) {
|
||||
b.add(one, getBoost(player, job, one, force));
|
||||
|
@ -203,12 +203,9 @@ public class JobsPlayer {
|
||||
|
||||
public double getBoost(String JobName, CurrencyType type, boolean force) {
|
||||
double Boost = 0D;
|
||||
Debug.D("1 "+this.isOnline());
|
||||
|
||||
if (!this.isOnline())
|
||||
return Boost;
|
||||
|
||||
Debug.D("4 ");
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
if (this.boostCounter.containsKey(JobName)) {
|
||||
@ -243,15 +240,14 @@ public class JobsPlayer {
|
||||
Double v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + JobName + "." + type.getName().toLowerCase(), true);
|
||||
Boost = v1;
|
||||
v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost." + JobName + ".all");
|
||||
if (Boost == null ||v1 != null && v1 > Boost)
|
||||
if (Boost == null || v1 != null && v1 > Boost)
|
||||
Boost = v1;
|
||||
v1 = Jobs.getPermissionManager().getMaxPermission(this, "jobs.boost.all.all");
|
||||
if (Boost == null ||v1 != null && v1 > Boost)
|
||||
if (Boost == null || v1 != null && v1 > Boost)
|
||||
Boost = v1;
|
||||
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;
|
||||
Debug.D("bonus " + Boost);
|
||||
return Boost == null ? 0D : Boost;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user