Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
fix legacy console disconnect messages (#1197)
Dieser Commit ist enthalten in:
Ursprung
c7c65e3339
Commit
eabff2020f
@ -103,13 +103,12 @@ import net.kyori.adventure.platform.facet.FacetPointers.Type;
|
||||
import net.kyori.adventure.pointer.Pointers;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import net.kyori.adventure.title.Title.Times;
|
||||
import net.kyori.adventure.title.TitlePart;
|
||||
import net.kyori.adventure.translation.GlobalTranslator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@ -126,7 +125,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
|
||||
PlainTextComponentSerializer.builder().flattener(TranslatableMapper.FLATTENER).build();
|
||||
static final PermissionProvider DEFAULT_PERMISSIONS = s -> PermissionFunction.ALWAYS_UNDEFINED;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ConnectedPlayer.class);
|
||||
private static final ComponentLogger logger = ComponentLogger.logger(ConnectedPlayer.class);
|
||||
|
||||
private final Identity identity = new IdentityImpl();
|
||||
/**
|
||||
@ -577,8 +576,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player,
|
||||
Component translated = this.translateMessage(reason);
|
||||
|
||||
if (server.getConfiguration().isLogPlayerConnections()) {
|
||||
logger.info("{} has disconnected: {}", this,
|
||||
LegacyComponentSerializer.legacySection().serialize(translated));
|
||||
logger.info(Component.text(this + " has disconnected: ").append(translated));
|
||||
}
|
||||
connection.closeWith(Disconnect.create(translated, this.getProtocolVersion(), duringLogin));
|
||||
}
|
||||
|
@ -29,10 +29,8 @@ import java.net.InetSocketAddress;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||
import net.kyori.adventure.translation.GlobalTranslator;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Implements {@link InboundConnection} for a newly-established connection.
|
||||
@ -40,7 +38,8 @@ import org.apache.logging.log4j.Logger;
|
||||
public final class InitialInboundConnection implements VelocityInboundConnection,
|
||||
MinecraftConnectionAssociation {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(InitialInboundConnection.class);
|
||||
private static final ComponentLogger logger = ComponentLogger
|
||||
.logger(InitialInboundConnection.class);
|
||||
|
||||
private final MinecraftConnection connection;
|
||||
private final String cleanedAddress;
|
||||
@ -97,8 +96,7 @@ public final class InitialInboundConnection implements VelocityInboundConnection
|
||||
Component translated = GlobalTranslator.render(reason, ClosestLocaleMatcher.INSTANCE
|
||||
.lookupClosest(Locale.getDefault()));
|
||||
if (connection.server.getConfiguration().isLogPlayerConnections()) {
|
||||
logger.info("{} has disconnected: {}", this,
|
||||
LegacyComponentSerializer.legacySection().serialize(translated));
|
||||
logger.info(Component.text(this + " has disconnected: ").append(translated));
|
||||
}
|
||||
connection.closeWith(Disconnect.create(translated, getProtocolVersion(), true));
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren