blob: 874be6879a915bc1085da0f5f6721d38c2f01579 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
--- a/net/minecraft/server/ExpiringMap.java
+++ b/net/minecraft/server/ExpiringMap.java
@@ -4,8 +4,10 @@
import it.unimi.dsi.fastutil.longs.Long2LongMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2LongMap.Entry;
+import it.unimi.dsi.fastutil.objects.ObjectCollection;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import java.util.Map;
+import java.util.function.LongFunction;
public class ExpiringMap<T> extends Long2ObjectOpenHashMap<T> {
@@ -21,11 +23,17 @@
long j = SystemUtils.b();
this.b.put(i, j);
- ObjectIterator objectiterator = this.b.long2LongEntrySet().iterator();
+ cleanup();
+ // CraftBukkit start
+ }
+
+ public void cleanup() {
+ long j = SystemUtils.b();
+ ObjectIterator<Long2LongMap.Entry> objectiterator = this.b.long2LongEntrySet().iterator(); // CraftBukkit - decompile error
while (objectiterator.hasNext()) {
- Entry entry = (Entry) objectiterator.next();
- Object object = super.get(entry.getLongKey());
+ Long2LongMap.Entry entry = (Long2LongMap.Entry) objectiterator.next(); // CraftBukkit - decompile error
+ T object = super.get(entry.getLongKey()); // CraftBukkit - decompile error
if (j - entry.getLongValue() <= (long) this.a) {
break;
@@ -36,6 +44,7 @@
objectiterator.remove();
}
}
+ // CraftBukkit end
}
@@ -69,4 +78,18 @@
public T remove(Object object) {
throw new RuntimeException("Not implemented");
}
+
+ // CraftBukkit start
+ @Override
+ public T computeIfAbsent(long l, LongFunction<? extends T> lf) {
+ this.b.put(l, SystemUtils.b());
+ return super.computeIfAbsent(l, lf);
+ }
+
+ @Override
+ public ObjectCollection<T> values() {
+ cleanup();
+ return super.values();
+ }
+ // CraftBukkit end
}
|