Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-04 23:30:24 +01:00
Warn users that it doesn't work with late-bind (possibly allow it in future), also stop bytebuf input mem leak.
Dieser Commit ist enthalten in:
Ursprung
0930420844
Commit
135942c033
@ -5,10 +5,7 @@ import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import net.minecraft.server.v1_8_R3.Entity;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R3.ServerConnection;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
import net.minecraft.server.v1_8_R3.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -33,16 +30,19 @@ public class Core extends JavaPlugin {
|
||||
try {
|
||||
injectPacketHandler();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Unable to inject handlers, this version only supports 1.8.8.");
|
||||
e.printStackTrace();
|
||||
System.out.println("Unable to inject handlers, this version only supports 1.8.");
|
||||
}
|
||||
}
|
||||
|
||||
public void injectPacketHandler() throws NoSuchFieldException, IllegalAccessException {
|
||||
public void injectPacketHandler() throws Exception {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
ServerConnection connection = server.getServerConnection();
|
||||
|
||||
List<ChannelFuture> futures = getPrivateField(connection, "g", List.class);
|
||||
if(futures.size() == 0){
|
||||
throw new Exception("Could not find server to inject (late bind?)");
|
||||
}
|
||||
|
||||
for (ChannelFuture future : futures) {
|
||||
ChannelPipeline pipeline = future.channel().pipeline();
|
||||
|
@ -37,6 +37,8 @@ public class ViaInboundHandler extends ChannelInboundHandlerAdapter {
|
||||
incomingTransformer.transform(id, bytebuf, newPacket);
|
||||
} catch (CancelException e) {
|
||||
return;
|
||||
} finally {
|
||||
bytebuf.release();
|
||||
}
|
||||
if (compression) {
|
||||
// recompress :)
|
||||
|
@ -35,6 +35,8 @@ public class ViaOutboundHandler extends ChannelOutboundHandlerAdapter {
|
||||
outgoingTransformer.transform(id, bytebuf, newPacket);
|
||||
} catch (CancelException e) {
|
||||
return;
|
||||
} finally {
|
||||
bytebuf.release();
|
||||
}
|
||||
if (compression) {
|
||||
// recompress :)
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren