1
0
mirror of https://github.com/GeyserMC/Geyser.git synced 2026-01-03 22:16:31 +00:00

Fix issues with Geyser-Spigot that occurring with older server versions

This commit is contained in:
onebeastchris
2025-01-19 14:29:58 +01:00
parent dff7cf2136
commit 98f9bf6b62
3 changed files with 20 additions and 3 deletions

View File

@@ -67,7 +67,7 @@ public class TextDisplayEntity extends DisplayBaseEntity {
}
public void setText(EntityMetadata<Component, ?> entityMetadata) {
this.dirtyMetadata.put(EntityDataTypes.NAME, MessageTranslator.convertMessage(entityMetadata.getValue()));
this.dirtyMetadata.put(EntityDataTypes.NAME, MessageTranslator.convertMessage(entityMetadata.getValue(), session.locale()));
calculateLineCount(entityMetadata.getValue());
}

View File

@@ -31,8 +31,11 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFactory;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelOption;
import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.ReflectiveChannelFactory;
import io.netty.channel.unix.PreferredDirectByteBufAllocator;
import io.netty.util.concurrent.DefaultThreadFactory;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.mcprotocollib.network.helper.NettyHelper;
import org.geysermc.mcprotocollib.network.netty.MinecraftChannelInitializer;
@@ -42,11 +45,13 @@ import org.geysermc.mcprotocollib.network.session.ClientNetworkSession;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
/**
* Manages a Minecraft Java session over our LocalChannel implementations.
*/
public final class LocalSession extends ClientNetworkSession {
private static DefaultEventLoopGroup DEFAULT_EVENT_LOOP_GROUP;
private static PreferredDirectByteBufAllocator PREFERRED_DIRECT_BYTE_BUF_ALLOCATOR = null;
private final SocketAddress spoofedRemoteAddress;
@@ -68,6 +73,17 @@ public final class LocalSession extends ClientNetworkSession {
}
}
@Override
protected EventLoopGroup getEventLoopGroup() {
if (DEFAULT_EVENT_LOOP_GROUP == null) {
DEFAULT_EVENT_LOOP_GROUP = new DefaultEventLoopGroup(new DefaultThreadFactory(this.getClass(), true));
Runtime.getRuntime().addShutdownHook(new Thread(
() -> DEFAULT_EVENT_LOOP_GROUP.shutdownGracefully(100, 500, TimeUnit.MILLISECONDS)));
}
return DEFAULT_EVENT_LOOP_GROUP;
}
@Override
protected ChannelHandler getChannelHandler() {
return new MinecraftChannelInitializer<>(channel -> {

View File

@@ -173,6 +173,7 @@ import org.geysermc.geyser.session.cache.WorldBorder;
import org.geysermc.geyser.session.cache.WorldCache;
import org.geysermc.geyser.text.GeyserLocale;
import org.geysermc.geyser.translator.inventory.InventoryTranslator;
import org.geysermc.geyser.translator.text.MessageTranslator;
import org.geysermc.geyser.util.ChunkUtils;
import org.geysermc.geyser.util.EntityUtils;
import org.geysermc.geyser.util.InventoryUtils;
@@ -1025,7 +1026,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
// Downstream's disconnect will fire an event that prints a log message
// Otherwise, we print a message here
String address = geyser.getConfig().isLogPlayerIpAddresses() ? upstream.getAddress().getAddress().toString() : "<IP address withheld>";
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.disconnect", address, reason));
geyser.getLogger().info(GeyserLocale.getLocaleStringLog("geyser.network.disconnect", address, MessageTranslator.convertMessage(reason)));
}
// Disconnect upstream if necessary
@@ -1646,7 +1647,7 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
}
if (protocol.getOutboundState() != intendedState) {
geyser.getLogger().warning("Tried to send " + packet.getClass().getSimpleName() + " packet while not in " + intendedState.name() + " outbound state. Current state: " + protocol.getOutboundState().name());
geyser.getLogger().debug("Tried to send " + packet.getClass().getSimpleName() + " packet while not in " + intendedState.name() + " outbound state. Current state: " + protocol.getOutboundState().name());
return;
}