mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 04:57:27 +00:00
NpcAPI:
-Fixed concurrent modification exception
This commit is contained in:
1 parent
500034f5f5
commit
65f3f8fc74
1 file changed
+7
-1
@@ -372,7 +372,13 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
scriptStack.lastAccessed = time;
|
||||
scriptItemCache.entrySet().removeIf(entry -> time - entry.getValue().lastAccessed > 20000);
|
||||
Iterator<Map.Entry<ItemStack, ScriptItemStack>> iterator = scriptItemCache.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<ItemStack, ScriptItemStack> entry = iterator.next();
|
||||
if (time - entry.getValue().lastAccessed > 20000) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
scriptItemCache.put(itemstack,scriptStack);
|
||||
|
||||
return scriptStack;
|
||||
|
||||
Reference in new issue
Block a user