解决了无法自动切换玩家任务队列的bug

This commit is contained in:
张宇衡 2023-06-04 00:16:08 +08:00
parent ee78a96e14
commit a338b33172
2 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<groupId>site.deercloud</groupId>
<artifactId>LiteWorldEdit</artifactId>
<version>1.3-SNAPSHOT</version>
<version>1.4-SNAPSHOT</version>
<packaging>jar</packaging>
<name>LiteWorldEdit</name>

View File

@ -50,6 +50,7 @@ public class Cache {
return null;
}
if (_jobs.get(player).isEmpty()) {
_jobs.remove(player);
return null;
}
Job job = _jobs.get(player).pop();
@ -88,17 +89,20 @@ public class Cache {
return null;
}
if (_last_jobs_player == null) {
return _jobs.keySet().iterator().next();
_last_jobs_player = _jobs.keySet().iterator().next();
return _last_jobs_player;
}
boolean found = false;
for (String key : _jobs.keySet()) {
if (found) {
_last_jobs_player = key;
return key;
}
if (key.equals(_last_jobs_player)) {
found = true;
}
}
return _jobs.keySet().iterator().next();
_last_jobs_player = _jobs.keySet().iterator().next();
return _last_jobs_player;
}
}