mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 20:16:19 +01:00
76 lines
4.8 KiB
Diff
76 lines
4.8 KiB
Diff
|
From 5b7fa8b79798a56e956c7b5011c3298bc0de2a3c Mon Sep 17 00:00:00 2001
|
||
|
From: Aikar <aikar@aikar.co>
|
||
|
Date: Sat, 1 Sep 2018 12:19:19 -0400
|
||
|
Subject: [PATCH 1/2] scheduler decompile fox
|
||
|
|
||
|
---
|
||
|
.../java/net/minecraft/server/Scheduler.java | 20 +++++++++----------
|
||
|
1 file changed, 10 insertions(+), 10 deletions(-)
|
||
|
|
||
|
diff --git a/src/main/java/net/minecraft/server/Scheduler.java b/src/main/java/net/minecraft/server/Scheduler.java
|
||
|
index ed155c8b30..1c327c58e7 100644
|
||
|
--- a/src/main/java/net/minecraft/server/Scheduler.java
|
||
|
+++ b/src/main/java/net/minecraft/server/Scheduler.java
|
||
|
@@ -27,8 +27,8 @@ public abstract class Scheduler<K, T extends SchedulerTask<K, T>, R> {
|
||
|
private final ExecutorService c;
|
||
|
private final AtomicInteger d = new AtomicInteger(1);
|
||
|
private final List<CompletableFuture<R>> e = Lists.newArrayList();
|
||
|
- private CompletableFuture<R> f = CompletableFuture.completedFuture((Object)null);
|
||
|
- private CompletableFuture<R> g = CompletableFuture.completedFuture((Object)null);
|
||
|
+ private CompletableFuture<R> f = CompletableFuture.completedFuture(null); // Paper - decompile fix
|
||
|
+ private CompletableFuture<R> g = CompletableFuture.completedFuture(null); // Paper - decompile fix
|
||
|
private final Supplier<Map<T, CompletableFuture<R>>> h;
|
||
|
private final Supplier<Map<T, CompletableFuture<Void>>> i;
|
||
|
private final T j;
|
||
|
@@ -121,12 +121,12 @@ public abstract class Scheduler<K, T extends SchedulerTask<K, T>, R> {
|
||
|
private final K c;
|
||
|
private final R d;
|
||
|
|
||
|
- public a(Object object, Object object1, SchedulerTask schedulertask) {
|
||
|
+ public a(Object object, Object object1, T schedulertask) { // Paper - decompile fix
|
||
|
this.b = (Map)Scheduler.this.h.get();
|
||
|
this.c = (K)object;
|
||
|
|
||
|
for(this.d = (R)object1; schedulertask != null; schedulertask = schedulertask.a()) {
|
||
|
- this.b.put(schedulertask, CompletableFuture.completedFuture(object1));
|
||
|
+ this.b.put(schedulertask, CompletableFuture.completedFuture((R)object1));// Paper - decompile fix
|
||
|
}
|
||
|
|
||
|
}
|
||
|
@@ -136,18 +136,18 @@ public abstract class Scheduler<K, T extends SchedulerTask<K, T>, R> {
|
||
|
}
|
||
|
|
||
|
private CompletableFuture<R> a(CompletableFuture<R> completablefuture, T schedulertask) {
|
||
|
- ConcurrentHashMap concurrenthashmap = new ConcurrentHashMap();
|
||
|
- return (CompletableFuture)this.b.computeIfAbsent(schedulertask, (var4) -> {
|
||
|
+ ConcurrentHashMap<K, CompletableFuture<R>> concurrenthashmap = new ConcurrentHashMap(); // Paper - decompile fix
|
||
|
+ return (CompletableFuture<R>)this.b.computeIfAbsent(schedulertask, (var4) -> { // Paper - decompile fix
|
||
|
if (schedulertask.a() == null) {
|
||
|
return CompletableFuture.completedFuture(this.d);
|
||
|
} else {
|
||
|
schedulertask.a(this.c, (object, schedulertask2) -> {
|
||
|
- CompletableFuture completablefuture4 = (CompletableFuture)concurrenthashmap.put(object, Scheduler.this.a(object, Scheduler.this.b(object)).a(completablefuture, schedulertask2));
|
||
|
+ CompletableFuture<R> completablefuture4 = (CompletableFuture)concurrenthashmap.put(object, Scheduler.this.a(object, Scheduler.this.b(object)).a(completablefuture, schedulertask2)); // Paper - decompile fix
|
||
|
});
|
||
|
- CompletableFuture[] acompletablefuture = (CompletableFuture[])Streams.concat(new Stream[]{Stream.of(completablefuture), concurrenthashmap.values().stream()}).toArray((i) -> {
|
||
|
+ CompletableFuture<R>[] acompletablefuture = (CompletableFuture[])Streams.concat(new Stream[]{Stream.of(completablefuture), concurrenthashmap.values().stream()}).toArray((i) -> { // Paper - decompile fix
|
||
|
return new CompletableFuture[i];
|
||
|
});
|
||
|
- CompletableFuture completablefuture2 = CompletableFuture.allOf(acompletablefuture).thenApplyAsync((var3) -> {
|
||
|
+ CompletableFuture<R> completablefuture2 = CompletableFuture.allOf(acompletablefuture).thenApplyAsync((var3) -> { // Paper - decompile fix
|
||
|
return Scheduler.this.a(this.c, schedulertask, Maps.transformValues(concurrenthashmap, (completablefuture3) -> {
|
||
|
try {
|
||
|
return completablefuture3.get();
|
||
|
@@ -156,7 +156,7 @@ public abstract class Scheduler<K, T extends SchedulerTask<K, T>, R> {
|
||
|
}
|
||
|
}));
|
||
|
}, Scheduler.this.c).thenApplyAsync((object) -> {
|
||
|
- for(Object object1 : concurrenthashmap.keySet()) {
|
||
|
+ for(K object1 : concurrenthashmap.keySet()) { // Paper - decompile fix
|
||
|
Scheduler.this.b(object1, Scheduler.this.b(object1));
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.18.0
|
||
|
|