解决了无法自动切换玩家任务队列的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> <groupId>site.deercloud</groupId>
<artifactId>LiteWorldEdit</artifactId> <artifactId>LiteWorldEdit</artifactId>
<version>1.3-SNAPSHOT</version> <version>1.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>LiteWorldEdit</name> <name>LiteWorldEdit</name>

View File

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