Skip to content

Commit

Permalink
Fix ProtocolLib issues on Java 15
Browse files Browse the repository at this point in the history
  • Loading branch information
Phoenix616 committed Oct 19, 2020
1 parent 23fe2d3 commit b2e2341
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions patches/server/0031-Fix-ProtocolLib-issues-on-Java-15.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
From c22c1ce7b69e6dd59e1af5636ef09bb33ec6a909 Mon Sep 17 00:00:00 2001
From: Phoenix616 <max@themoep.de>
Date: Mon, 19 Oct 2020 17:20:53 +0100
Subject: [PATCH] Fix ProtocolLib issues on Java 15

This replaces a lambda with an anonymous class to work around an issue
where ProtocolLib cannot access certain fields via reflections when
running on Java 15 due to lambdas now being considered hidden and not
accessible via reflections.

Thanks to https://github.com/PimvanderLoos for figuring this out here:
https://github.com/dmulloy2/ProtocolLib/issues/978
---
src/main/java/net/minecraft/server/NetworkManager.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index c9b36e6040..34e8e23955 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -285,9 +285,9 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
// Paper end
} else {
- this.channel.eventLoop().execute(() -> {
+ this.channel.eventLoop().execute(new Runnable() { public void run() { // Origami - remove lambda
if (enumprotocol != enumprotocol1) {
- this.setProtocol(enumprotocol);
+ NetworkManager.this.setProtocol(enumprotocol); // Origami - remove lambda
}

// Paper start
@@ -297,7 +297,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
try {
// Paper end
- ChannelFuture channelfuture1 = this.channel.writeAndFlush(packet);
+ ChannelFuture channelfuture1 = NetworkManager.this.channel.writeAndFlush(packet); // Origami - remove lambda


if (genericfuturelistener != null) {
@@ -317,7 +317,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
packet.onPacketDispatchFinish(player, null);
}
// Paper end
- });
+ }}); // Origami - remove lambda
}

}
--
2.25.1.windows.1

0 comments on commit b2e2341

Please sign in to comment.