Skip to content

Commit f606cc9

Browse files
authored
Add support for ShreddedPaper's lazy packet execution (#3592)
1 parent 774e679 commit f606cc9

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/main/java/com/comphenix/protocol/injector/netty/channel/NettyEventLoopProxy.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
import java.util.concurrent.TimeoutException;
1111
import java.util.function.Consumer;
1212

13+
import io.netty.channel.AbstractEventLoop;
1314
import io.netty.channel.Channel;
1415
import io.netty.channel.ChannelFuture;
1516
import io.netty.channel.ChannelPromise;
1617
import io.netty.channel.EventLoop;
1718
import io.netty.channel.EventLoopGroup;
19+
import io.netty.util.concurrent.AbstractEventExecutor;
1820
import io.netty.util.concurrent.EventExecutor;
1921
import io.netty.util.concurrent.Future;
2022
import io.netty.util.concurrent.ProgressivePromise;
@@ -25,7 +27,7 @@
2527
* An abstract event loop implementation which delegates all calls to a given event loop, but proxies all calls which
2628
* schedule something on the event loop to methods which decide what should happen to the scheduled task.
2729
*/
28-
final class NettyEventLoopProxy implements EventLoop {
30+
final class NettyEventLoopProxy extends AbstractEventLoop {
2931

3032
private static final Callable<?> EMPTY_CALLABLE = () -> null;
3133
private static final Runnable EMPTY_RUNNABLE = () -> {
@@ -236,6 +238,15 @@ public void execute(Runnable command) {
236238
}
237239
}
238240

241+
// ShreddedPaper uses this method
242+
@Override
243+
public void lazyExecute(Runnable command) {
244+
Runnable proxied = this.proxyRunnable(command);
245+
if (proxied != null) {
246+
((AbstractEventExecutor)this.delegate).lazyExecute(proxied);
247+
}
248+
}
249+
239250
@Override
240251
public void forEach(Consumer<? super EventExecutor> action) {
241252
this.delegate.forEach(action);

0 commit comments

Comments
 (0)