Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Update for 1.19
Dieser Commit ist enthalten in:
Ursprung
37d6fd8abf
Commit
2af10ad8bd
@ -23,7 +23,7 @@
|
|||||||
* @link https://github.com/GeyserMC/Geyser
|
* @link https://github.com/GeyserMC/Geyser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.platform.bungeecord;
|
package org.geysermc.geyser.platform.bungeecord;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
||||||
|
@ -168,7 +168,7 @@ public class GeyserBungeeInjector extends GeyserInjector implements Listener {
|
|||||||
// If native compression is enabled, then this line is tripped up if a heap buffer is sent over in such a situation
|
// If native compression is enabled, then this line is tripped up if a heap buffer is sent over in such a situation
|
||||||
// as a new direct buffer is not created with that patch (HeapByteBufs throw an UnsupportedOperationException here):
|
// as a new direct buffer is not created with that patch (HeapByteBufs throw an UnsupportedOperationException here):
|
||||||
// https://github.com/SpigotMC/BungeeCord/blob/a283aaf724d4c9a815540cd32f3aafaa72df9e05/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java#L43
|
// https://github.com/SpigotMC/BungeeCord/blob/a283aaf724d4c9a815540cd32f3aafaa72df9e05/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java#L43
|
||||||
// This issue could be mitigated down the line by preventing Bungee from setting compression
|
// If disable compression is enabled, this can probably be disabled now, but BungeeCord (not Waterfall) complains
|
||||||
LocalSession.createDirectByteBufAllocator();
|
LocalSession.createDirectByteBufAllocator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,13 +23,13 @@
|
|||||||
* @link https://github.com/GeyserMC/Geyser
|
* @link https://github.com/GeyserMC/Geyser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.platform.spigot;
|
package org.geysermc.geyser.platform.spigot;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the compression packet (and the compression handlers from being added to the pipeline) for Geyser clients
|
* Disables the compression packet (and the compression handlers from being added to the pipeline) for Geyser clients
|
||||||
@ -39,7 +39,7 @@ import org.geysermc.connector.GeyserConnector;
|
|||||||
* If we simply "cancel" or don't forward the packet, then the listener is never called.
|
* If we simply "cancel" or don't forward the packet, then the listener is never called.
|
||||||
*/
|
*/
|
||||||
public class GeyserSpigotCompressionDisabler extends ChannelOutboundHandlerAdapter {
|
public class GeyserSpigotCompressionDisabler extends ChannelOutboundHandlerAdapter {
|
||||||
public static final boolean ENABLED;
|
static final boolean ENABLED;
|
||||||
|
|
||||||
private static final Class<?> COMPRESSION_PACKET_CLASS;
|
private static final Class<?> COMPRESSION_PACKET_CLASS;
|
||||||
private static final Class<?> LOGIN_SUCCESS_PACKET_CLASS;
|
private static final Class<?> LOGIN_SUCCESS_PACKET_CLASS;
|
||||||
@ -56,7 +56,7 @@ public class GeyserSpigotCompressionDisabler extends ChannelOutboundHandlerAdapt
|
|||||||
loginSuccessPacketClass = findLoginSuccessPacket();
|
loginSuccessPacketClass = findLoginSuccessPacket();
|
||||||
enabled = true;
|
enabled = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GeyserConnector.getInstance().getLogger().error("Could not initialize compression disabler!", e);
|
GeyserImpl.getInstance().getLogger().error("Could not initialize compression disabler!", e);
|
||||||
}
|
}
|
||||||
COMPRESSION_PACKET_CLASS = compressionPacketClass;
|
COMPRESSION_PACKET_CLASS = compressionPacketClass;
|
||||||
LOGIN_SUCCESS_PACKET_CLASS = loginSuccessPacketClass;
|
LOGIN_SUCCESS_PACKET_CLASS = loginSuccessPacketClass;
|
||||||
|
@ -23,17 +23,17 @@
|
|||||||
* @link https://github.com/GeyserMC/Geyser
|
* @link https://github.com/GeyserMC/Geyser
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.platform.velocity;
|
package org.geysermc.geyser.platform.velocity;
|
||||||
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
import io.netty.channel.ChannelOutboundHandlerAdapter;
|
||||||
import io.netty.channel.ChannelPromise;
|
import io.netty.channel.ChannelPromise;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.geyser.GeyserImpl;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class GeyserVelocityCompressionDisabler extends ChannelOutboundHandlerAdapter {
|
public class GeyserVelocityCompressionDisabler extends ChannelOutboundHandlerAdapter {
|
||||||
public static final boolean ENABLED;
|
static final boolean ENABLED;
|
||||||
private static final Class<?> COMPRESSION_PACKET_CLASS;
|
private static final Class<?> COMPRESSION_PACKET_CLASS;
|
||||||
private static final Class<?> LOGIN_SUCCESS_PACKET_CLASS;
|
private static final Class<?> LOGIN_SUCCESS_PACKET_CLASS;
|
||||||
private static final Method SET_COMPRESSION_METHOD;
|
private static final Method SET_COMPRESSION_METHOD;
|
||||||
@ -51,7 +51,7 @@ public class GeyserVelocityCompressionDisabler extends ChannelOutboundHandlerAda
|
|||||||
.getMethod("setCompressionThreshold", int.class);
|
.getMethod("setCompressionThreshold", int.class);
|
||||||
enabled = true;
|
enabled = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GeyserConnector.getInstance().getLogger().error("Could not initialize compression disabler!", e);
|
GeyserImpl.getInstance().getLogger().error("Could not initialize compression disabler!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ENABLED = enabled;
|
ENABLED = enabled;
|
||||||
@ -69,9 +69,8 @@ public class GeyserVelocityCompressionDisabler extends ChannelOutboundHandlerAda
|
|||||||
@Override
|
@Override
|
||||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
||||||
Class<?> msgClass = msg.getClass();
|
Class<?> msgClass = msg.getClass();
|
||||||
// instanceOf doesn't work. Unsure why.
|
if (!COMPRESSION_PACKET_CLASS.isAssignableFrom(msgClass)) {
|
||||||
if (COMPRESSION_PACKET_CLASS != msgClass) {
|
if (LOGIN_SUCCESS_PACKET_CLASS.isAssignableFrom(msgClass)) {
|
||||||
if (LOGIN_SUCCESS_PACKET_CLASS == msgClass) {
|
|
||||||
// We're past the point that compression can be enabled
|
// We're past the point that compression can be enabled
|
||||||
// Invoke the method as it calls a Netty event and handles removing cleaner than we could
|
// Invoke the method as it calls a Netty event and handles removing cleaner than we could
|
||||||
Object minecraftConnection = ctx.pipeline().get("handler");
|
Object minecraftConnection = ctx.pipeline().get("handler");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren