3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 23:30:26 +01:00

Rename ConnectedPlayer#minecraftConnection -> ConnectedPlayer#connection

This is consistent with VelocityServerConnection
Dieser Commit ist enthalten in:
Andrew Steinborn 2019-08-17 20:17:12 -04:00
Ursprung d68cbbd906
Commit dbfbd1e2a9
9 geänderte Dateien mit 55 neuen und 60 gelöschten Zeilen

Datei anzeigen

@ -505,7 +505,7 @@ public class VelocityServer implements ProxyServer {
Preconditions.checkNotNull(component, "component"); Preconditions.checkNotNull(component, "component");
Chat chat = Chat.createClientbound(component); Chat chat = Chat.createClientbound(component);
for (ConnectedPlayer player : connectionsByUuid.values()) { for (ConnectedPlayer player : connectionsByUuid.values()) {
player.getMinecraftConnection().write(chat); player.getConnection().write(chat);
} }
} }

Datei anzeigen

@ -5,20 +5,17 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder; import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.tree.LiteralCommandNode; import com.mojang.brigadier.tree.LiteralCommandNode;
import com.velocitypowered.api.event.connection.PluginMessageEvent; import com.velocitypowered.api.event.connection.PluginMessageEvent;
import com.velocitypowered.api.network.ProtocolVersion;
import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelIdentifier;
import com.velocitypowered.proxy.VelocityServer; import com.velocitypowered.proxy.VelocityServer;
import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftConnection;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler; import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler; import com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler;
import com.velocitypowered.proxy.connection.forge.legacy.LegacyForgeConstants;
import com.velocitypowered.proxy.connection.util.ConnectionMessages; import com.velocitypowered.proxy.connection.util.ConnectionMessages;
import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.packet.AvailableCommands; import com.velocitypowered.proxy.protocol.packet.AvailableCommands;
import com.velocitypowered.proxy.protocol.packet.AvailableCommands.ProtocolSuggestionProvider; import com.velocitypowered.proxy.protocol.packet.AvailableCommands.ProtocolSuggestionProvider;
import com.velocitypowered.proxy.protocol.packet.BossBar; import com.velocitypowered.proxy.protocol.packet.BossBar;
import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.protocol.packet.Disconnect;
import com.velocitypowered.proxy.protocol.packet.JoinGame;
import com.velocitypowered.proxy.protocol.packet.KeepAlive; import com.velocitypowered.proxy.protocol.packet.KeepAlive;
import com.velocitypowered.proxy.protocol.packet.PlayerListItem; import com.velocitypowered.proxy.protocol.packet.PlayerListItem;
import com.velocitypowered.proxy.protocol.packet.PluginMessage; import com.velocitypowered.proxy.protocol.packet.PluginMessage;
@ -39,7 +36,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
BackendPlaySessionHandler(VelocityServer server, VelocityServerConnection serverConn) { BackendPlaySessionHandler(VelocityServer server, VelocityServerConnection serverConn) {
this.server = server; this.server = server;
this.serverConn = serverConn; this.serverConn = serverConn;
this.playerConnection = serverConn.getPlayer().getMinecraftConnection(); this.playerConnection = serverConn.getPlayer().getConnection();
MinecraftSessionHandler psh = playerConnection.getSessionHandler(); MinecraftSessionHandler psh = playerConnection.getSessionHandler();
if (!(psh instanceof ClientPlaySessionHandler)) { if (!(psh instanceof ClientPlaySessionHandler)) {

Datei anzeigen

@ -84,13 +84,13 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
.whenCompleteAsync((x, error) -> { .whenCompleteAsync((x, error) -> {
// Strap on the ClientPlaySessionHandler if required. // Strap on the ClientPlaySessionHandler if required.
ClientPlaySessionHandler playHandler; ClientPlaySessionHandler playHandler;
if (serverConn.getPlayer().getMinecraftConnection().getSessionHandler() if (serverConn.getPlayer().getConnection().getSessionHandler()
instanceof ClientPlaySessionHandler) { instanceof ClientPlaySessionHandler) {
playHandler = (ClientPlaySessionHandler) serverConn.getPlayer().getMinecraftConnection() playHandler = (ClientPlaySessionHandler) serverConn.getPlayer().getConnection()
.getSessionHandler(); .getSessionHandler();
} else { } else {
playHandler = new ClientPlaySessionHandler(server, serverConn.getPlayer()); playHandler = new ClientPlaySessionHandler(server, serverConn.getPlayer());
serverConn.getPlayer().getMinecraftConnection().setSessionHandler(playHandler); serverConn.getPlayer().getConnection().setSessionHandler(playHandler);
} }
playHandler.handleBackendJoinGame(packet, serverConn); playHandler.handleBackendJoinGame(packet, serverConn);
@ -167,7 +167,7 @@ public class TransitionSessionHandler implements MinecraftSessionHandler {
return true; return true;
} }
serverConn.getPlayer().getMinecraftConnection().write(packet.retain()); serverConn.getPlayer().getConnection().write(packet.retain());
return true; return true;
} }

Datei anzeigen

@ -76,7 +76,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
CompletableFuture<Impl> result = new CompletableFuture<>(); CompletableFuture<Impl> result = new CompletableFuture<>();
// Note: we use the event loop for the connection the player is on. This reduces context // Note: we use the event loop for the connection the player is on. This reduces context
// switches. // switches.
server.createBootstrap(proxyPlayer.getMinecraftConnection().eventLoop()) server.createBootstrap(proxyPlayer.getConnection().eventLoop())
.handler(new ChannelInitializer<Channel>() { .handler(new ChannelInitializer<Channel>() {
@Override @Override
protected void initChannel(Channel ch) throws Exception { protected void initChannel(Channel ch) throws Exception {
@ -138,13 +138,13 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
PlayerInfoForwarding forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode(); PlayerInfoForwarding forwardingMode = server.getConfiguration().getPlayerInfoForwardingMode();
// Initiate the handshake. // Initiate the handshake.
ProtocolVersion protocolVersion = proxyPlayer.getMinecraftConnection().getNextProtocolVersion(); ProtocolVersion protocolVersion = proxyPlayer.getConnection().getNextProtocolVersion();
Handshake handshake = new Handshake(); Handshake handshake = new Handshake();
handshake.setNextStatus(StateRegistry.LOGIN_ID); handshake.setNextStatus(StateRegistry.LOGIN_ID);
handshake.setProtocolVersion(protocolVersion); handshake.setProtocolVersion(protocolVersion);
if (forwardingMode == PlayerInfoForwarding.LEGACY) { if (forwardingMode == PlayerInfoForwarding.LEGACY) {
handshake.setServerAddress(createLegacyForwardingAddress()); handshake.setServerAddress(createLegacyForwardingAddress());
} else if (proxyPlayer.getMinecraftConnection().getType() == ConnectionTypes.LEGACY_FORGE) { } else if (proxyPlayer.getConnection().getType() == ConnectionTypes.LEGACY_FORGE) {
handshake.setServerAddress(handshake.getServerAddress() + HANDSHAKE_HOSTNAME_TOKEN); handshake.setServerAddress(handshake.getServerAddress() + HANDSHAKE_HOSTNAME_TOKEN);
} else { } else {
handshake.setServerAddress(registeredServer.getServerInfo().getAddress().getHostString()); handshake.setServerAddress(registeredServer.getServerInfo().getAddress().getHostString());

Datei anzeigen

@ -40,7 +40,6 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Queue; import java.util.Queue;
import java.util.UUID; import java.util.UUID;
import net.kyori.text.Component;
import net.kyori.text.TextComponent; import net.kyori.text.TextComponent;
import net.kyori.text.format.TextColor; import net.kyori.text.format.TextColor;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
@ -78,7 +77,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
.getProtocolVersion()); .getProtocolVersion());
if (!channels.isEmpty()) { if (!channels.isEmpty()) {
PluginMessage register = constructChannelsPacket(player.getProtocolVersion(), channels); PluginMessage register = constructChannelsPacket(player.getProtocolVersion(), channels);
player.getMinecraftConnection().write(register); player.getConnection().write(register);
player.getKnownChannels().addAll(channels); player.getKnownChannels().addAll(channels);
} }
} }
@ -275,7 +274,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
public void writabilityChanged() { public void writabilityChanged() {
VelocityServerConnection serverConn = player.getConnectedServer(); VelocityServerConnection serverConn = player.getConnectedServer();
if (serverConn != null) { if (serverConn != null) {
boolean writable = player.getMinecraftConnection().getChannel().isWritable(); boolean writable = player.getConnection().getChannel().isWritable();
MinecraftConnection smc = serverConn.getConnection(); MinecraftConnection smc = serverConn.getConnection();
if (smc != null) { if (smc != null) {
smc.setAutoReading(writable); smc.setAutoReading(writable);
@ -295,7 +294,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
if (!spawned) { if (!spawned) {
// Nothing special to do with regards to spawning the player // Nothing special to do with regards to spawning the player
spawned = true; spawned = true;
player.getMinecraftConnection().delayedWrite(joinGame); player.getConnection().delayedWrite(joinGame);
// Required for Legacy Forge // Required for Legacy Forge
player.getPhase().onFirstJoin(player); player.getPhase().onFirstJoin(player);
@ -315,12 +314,12 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
// Most notably, by having the client accept the join game packet, we can work around the need // Most notably, by having the client accept the join game packet, we can work around the need
// to perform entity ID rewrites, eliminating potential issues from rewriting packets and // to perform entity ID rewrites, eliminating potential issues from rewriting packets and
// improving compatibility with mods. // improving compatibility with mods.
player.getMinecraftConnection().delayedWrite(joinGame); player.getConnection().delayedWrite(joinGame);
int tempDim = joinGame.getDimension() == 0 ? -1 : 0; int tempDim = joinGame.getDimension() == 0 ? -1 : 0;
player.getMinecraftConnection().delayedWrite( player.getConnection().delayedWrite(
new Respawn(tempDim, joinGame.getDifficulty(), joinGame.getGamemode(), new Respawn(tempDim, joinGame.getDifficulty(), joinGame.getGamemode(),
joinGame.getLevelType())); joinGame.getLevelType()));
player.getMinecraftConnection().delayedWrite( player.getConnection().delayedWrite(
new Respawn(joinGame.getDimension(), joinGame.getDifficulty(), joinGame.getGamemode(), new Respawn(joinGame.getDimension(), joinGame.getDifficulty(), joinGame.getGamemode(),
joinGame.getLevelType())); joinGame.getLevelType()));
} }
@ -331,7 +330,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
BossBar deletePacket = new BossBar(); BossBar deletePacket = new BossBar();
deletePacket.setUuid(serverBossBar); deletePacket.setUuid(serverBossBar);
deletePacket.setAction(BossBar.REMOVE); deletePacket.setAction(BossBar.REMOVE);
player.getMinecraftConnection().delayedWrite(deletePacket); player.getConnection().delayedWrite(deletePacket);
} }
serverBossBars.clear(); serverBossBars.clear();
@ -348,11 +347,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
} }
// Clear any title from the previous server. // Clear any title from the previous server.
player.getMinecraftConnection() player.getConnection()
.delayedWrite(TitlePacket.resetForProtocolVersion(player.getProtocolVersion())); .delayedWrite(TitlePacket.resetForProtocolVersion(player.getProtocolVersion()));
// Flush everything // Flush everything
player.getMinecraftConnection().flush(); player.getConnection().flush();
serverMc.flush(); serverMc.flush();
destination.completeJoin(); destination.completeJoin();
} }
@ -410,7 +409,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
resp.setLength(length); resp.setLength(length);
resp.getOffers().addAll(offers); resp.getOffers().addAll(offers);
player.getMinecraftConnection().write(resp); player.getConnection().write(resp);
return true; return true;
} }
@ -450,7 +449,7 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
response.getOffers().add(new Offer(offer, null)); response.getOffers().add(new Offer(offer, null));
} }
response.getOffers().sort(null); response.getOffers().sort(null);
player.getMinecraftConnection().write(response); player.getConnection().write(response);
} catch (Exception e) { } catch (Exception e) {
logger.error("Unable to provide tab list completions for {} for command '{}'", logger.error("Unable to provide tab list completions for {} for command '{}'",
player.getUsername(), player.getUsername(),
@ -469,8 +468,8 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
for (String s : e.getSuggestions()) { for (String s : e.getSuggestions()) {
response.getOffers().add(new Offer(s)); response.getOffers().add(new Offer(s));
} }
player.getMinecraftConnection().write(response); player.getConnection().write(response);
}, player.getMinecraftConnection().eventLoop()); }, player.getConnection().eventLoop());
} }
/** /**

Datei anzeigen

@ -58,7 +58,6 @@ import java.util.Optional;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import net.kyori.text.Component; import net.kyori.text.Component;
import net.kyori.text.TextComponent; import net.kyori.text.TextComponent;
@ -84,7 +83,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
/** /**
* The actual Minecraft connection. This is actually a wrapper object around the Netty channel. * The actual Minecraft connection. This is actually a wrapper object around the Netty channel.
*/ */
private final MinecraftConnection minecraftConnection; private final MinecraftConnection connection;
private final @Nullable InetSocketAddress virtualHost; private final @Nullable InetSocketAddress virtualHost;
private GameProfile profile; private GameProfile profile;
private PermissionFunction permissionFunction; private PermissionFunction permissionFunction;
@ -103,14 +102,14 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
private @MonotonicNonNull List<String> serversToTry = null; private @MonotonicNonNull List<String> serversToTry = null;
ConnectedPlayer(VelocityServer server, GameProfile profile, ConnectedPlayer(VelocityServer server, GameProfile profile,
MinecraftConnection minecraftConnection, @Nullable InetSocketAddress virtualHost) { MinecraftConnection connection, @Nullable InetSocketAddress virtualHost) {
this.server = server; this.server = server;
this.tabList = new VelocityTabList(minecraftConnection); this.tabList = new VelocityTabList(connection);
this.profile = profile; this.profile = profile;
this.minecraftConnection = minecraftConnection; this.connection = connection;
this.virtualHost = virtualHost; this.virtualHost = virtualHost;
this.permissionFunction = PermissionFunction.ALWAYS_UNDEFINED; this.permissionFunction = PermissionFunction.ALWAYS_UNDEFINED;
this.connectionPhase = minecraftConnection.getType().getInitialClientPhase(); this.connectionPhase = connection.getType().getInitialClientPhase();
this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS); this.knownChannels = CappedSet.create(MAX_PLUGIN_CHANNELS);
} }
@ -134,8 +133,8 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
return profile; return profile;
} }
public MinecraftConnection getMinecraftConnection() { public MinecraftConnection getConnection() {
return minecraftConnection; return connection;
} }
@Override @Override
@ -170,7 +169,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
@Override @Override
public InetSocketAddress getRemoteAddress() { public InetSocketAddress getRemoteAddress() {
return (InetSocketAddress) minecraftConnection.getRemoteAddress(); return (InetSocketAddress) connection.getRemoteAddress();
} }
@Override @Override
@ -184,12 +183,12 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
@Override @Override
public boolean isActive() { public boolean isActive() {
return minecraftConnection.getChannel().isActive(); return connection.getChannel().isActive();
} }
@Override @Override
public ProtocolVersion getProtocolVersion() { public ProtocolVersion getProtocolVersion() {
return minecraftConnection.getProtocolVersion(); return connection.getProtocolVersion();
} }
@Override @Override
@ -205,7 +204,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
TitlePacket pkt = new TitlePacket(); TitlePacket pkt = new TitlePacket();
pkt.setAction(TitlePacket.SET_ACTION_BAR); pkt.setAction(TitlePacket.SET_ACTION_BAR);
pkt.setComponent(GsonComponentSerializer.INSTANCE.serialize(component)); pkt.setComponent(GsonComponentSerializer.INSTANCE.serialize(component));
minecraftConnection.write(pkt); connection.write(pkt);
return; return;
} else { } else {
// Due to issues with action bar packets, we'll need to convert the text message into a // Due to issues with action bar packets, we'll need to convert the text message into a
@ -221,7 +220,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
Chat chat = new Chat(); Chat chat = new Chat();
chat.setType(pos); chat.setType(pos);
chat.setMessage(json); chat.setMessage(json);
minecraftConnection.write(chat); connection.write(chat);
} }
@Override @Override
@ -258,23 +257,23 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
public void disconnect(Component reason) { public void disconnect(Component reason) {
logger.info("{} has disconnected: {}", this, logger.info("{} has disconnected: {}", this,
LegacyComponentSerializer.legacy().serialize(reason)); LegacyComponentSerializer.legacy().serialize(reason));
minecraftConnection.closeWith(Disconnect.create(reason)); connection.closeWith(Disconnect.create(reason));
} }
@Override @Override
public void sendTitle(Title title) { public void sendTitle(Title title) {
Preconditions.checkNotNull(title, "title"); Preconditions.checkNotNull(title, "title");
ProtocolVersion protocolVersion = minecraftConnection.getProtocolVersion(); ProtocolVersion protocolVersion = connection.getProtocolVersion();
if (title.equals(Titles.reset())) { if (title.equals(Titles.reset())) {
minecraftConnection.write(TitlePacket.resetForProtocolVersion(protocolVersion)); connection.write(TitlePacket.resetForProtocolVersion(protocolVersion));
} else if (title.equals(Titles.hide())) { } else if (title.equals(Titles.hide())) {
minecraftConnection.write(TitlePacket.hideForProtocolVersion(protocolVersion)); connection.write(TitlePacket.hideForProtocolVersion(protocolVersion));
} else if (title instanceof TextTitle) { } else if (title instanceof TextTitle) {
TextTitle tt = (TextTitle) title; TextTitle tt = (TextTitle) title;
if (tt.isResetBeforeSend()) { if (tt.isResetBeforeSend()) {
minecraftConnection.delayedWrite(TitlePacket.resetForProtocolVersion(protocolVersion)); connection.delayedWrite(TitlePacket.resetForProtocolVersion(protocolVersion));
} }
Optional<Component> titleText = tt.getTitle(); Optional<Component> titleText = tt.getTitle();
@ -282,7 +281,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
TitlePacket titlePkt = new TitlePacket(); TitlePacket titlePkt = new TitlePacket();
titlePkt.setAction(TitlePacket.SET_TITLE); titlePkt.setAction(TitlePacket.SET_TITLE);
titlePkt.setComponent(GsonComponentSerializer.INSTANCE.serialize(titleText.get())); titlePkt.setComponent(GsonComponentSerializer.INSTANCE.serialize(titleText.get()));
minecraftConnection.delayedWrite(titlePkt); connection.delayedWrite(titlePkt);
} }
Optional<Component> subtitleText = tt.getSubtitle(); Optional<Component> subtitleText = tt.getSubtitle();
@ -290,7 +289,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
TitlePacket titlePkt = new TitlePacket(); TitlePacket titlePkt = new TitlePacket();
titlePkt.setAction(TitlePacket.SET_SUBTITLE); titlePkt.setAction(TitlePacket.SET_SUBTITLE);
titlePkt.setComponent(GsonComponentSerializer.INSTANCE.serialize(subtitleText.get())); titlePkt.setComponent(GsonComponentSerializer.INSTANCE.serialize(subtitleText.get()));
minecraftConnection.delayedWrite(titlePkt); connection.delayedWrite(titlePkt);
} }
if (tt.areTimesSet()) { if (tt.areTimesSet()) {
@ -298,9 +297,9 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
timesPkt.setFadeIn(tt.getFadeIn()); timesPkt.setFadeIn(tt.getFadeIn());
timesPkt.setStay(tt.getStay()); timesPkt.setStay(tt.getStay());
timesPkt.setFadeOut(tt.getFadeOut()); timesPkt.setFadeOut(tt.getFadeOut());
minecraftConnection.delayedWrite(timesPkt); connection.delayedWrite(timesPkt);
} }
minecraftConnection.flush(); connection.flush();
} else { } else {
throw new IllegalArgumentException("Unknown title class " + title.getClass().getName()); throw new IllegalArgumentException("Unknown title class " + title.getClass().getName());
} }
@ -454,7 +453,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
} else { } else {
sendMessage(VelocityMessages.MOVED_TO_NEW_SERVER.append(friendlyReason)); sendMessage(VelocityMessages.MOVED_TO_NEW_SERVER.append(friendlyReason));
} }
}, minecraftConnection.eventLoop()); }, connection.eventLoop());
} else if (event.getResult() instanceof Notify) { } else if (event.getResult() instanceof Notify) {
Notify res = (Notify) event.getResult(); Notify res = (Notify) event.getResult();
if (event.kickedDuringServerConnect()) { if (event.kickedDuringServerConnect()) {
@ -466,7 +465,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
// In case someone gets creative, assume we want to disconnect the player. // In case someone gets creative, assume we want to disconnect the player.
disconnect(friendlyReason); disconnect(friendlyReason);
} }
}, minecraftConnection.eventLoop()); }, connection.eventLoop());
} }
/** /**
@ -579,7 +578,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
Preconditions.checkNotNull(identifier, "identifier"); Preconditions.checkNotNull(identifier, "identifier");
Preconditions.checkNotNull(data, "data"); Preconditions.checkNotNull(data, "data");
PluginMessage message = new PluginMessage(identifier.getId(), Unpooled.wrappedBuffer(data)); PluginMessage message = new PluginMessage(identifier.getId(), Unpooled.wrappedBuffer(data));
minecraftConnection.write(message); connection.write(message);
return true; return true;
} }
@ -598,7 +597,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
ResourcePackRequest request = new ResourcePackRequest(); ResourcePackRequest request = new ResourcePackRequest();
request.setUrl(url); request.setUrl(url);
request.setHash(""); request.setHash("");
minecraftConnection.write(request); connection.write(request);
} }
@Override @Override
@ -610,7 +609,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
ResourcePackRequest request = new ResourcePackRequest(); ResourcePackRequest request = new ResourcePackRequest();
request.setUrl(url); request.setUrl(url);
request.setHash(ByteBufUtil.hexDump(hash)); request.setHash(ByteBufUtil.hexDump(hash));
minecraftConnection.write(request); connection.write(request);
} }
/** /**
@ -619,10 +618,10 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
* ID last sent by the server. * ID last sent by the server.
*/ */
public void sendKeepAlive() { public void sendKeepAlive() {
if (minecraftConnection.getState() == StateRegistry.PLAY) { if (connection.getState() == StateRegistry.PLAY) {
KeepAlive keepAlive = new KeepAlive(); KeepAlive keepAlive = new KeepAlive();
keepAlive.setRandomId(ThreadLocalRandom.current().nextLong()); keepAlive.setRandomId(ThreadLocalRandom.current().nextLong());
minecraftConnection.write(keepAlive); connection.write(keepAlive);
} }
} }
@ -749,7 +748,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
} else if ((status != null && !status.isSuccessful())) { } else if ((status != null && !status.isSuccessful())) {
resetInFlightConnection(); resetInFlightConnection();
} }
}, minecraftConnection.eventLoop()) }, connection.eventLoop())
.thenApply(x -> x); .thenApply(x -> x);
} }
@ -782,7 +781,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
// The only remaining value is successful (no need to do anything!) // The only remaining value is successful (no need to do anything!)
break; break;
} }
}, minecraftConnection.eventLoop()) }, connection.eventLoop())
.thenApply(Result::isSuccessful); .thenApply(Result::isSuccessful);
} }

Datei anzeigen

@ -114,7 +114,7 @@ public enum LegacyForgeHandshakeBackendPhase implements BackendConnectionPhase {
serverConnection.setConnectionPhase(newPhase); serverConnection.setConnectionPhase(newPhase);
// Write the packet to the player, we don't need it now. // Write the packet to the player, we don't need it now.
player.getMinecraftConnection().write(message.retain()); player.getConnection().write(message.retain());
return true; return true;
} }

Datei anzeigen

@ -135,7 +135,7 @@ public enum LegacyForgeHandshakeClientPhase implements ClientConnectionPhase {
COMPLETE(null) { COMPLETE(null) {
@Override @Override
public void resetConnectionPhase(ConnectedPlayer player) { public void resetConnectionPhase(ConnectedPlayer player) {
player.getMinecraftConnection().write(LegacyForgeUtil.resetPacket()); player.getConnection().write(LegacyForgeUtil.resetPacket());
player.setPhase(LegacyForgeHandshakeClientPhase.NOT_STARTED); player.setPhase(LegacyForgeHandshakeClientPhase.NOT_STARTED);
} }

Datei anzeigen

@ -271,6 +271,6 @@ public class VelocityBossBar implements com.velocitypowered.api.util.bossbar.Bos
private void sendPacket(Player player, MinecraftPacket packet) { private void sendPacket(Player player, MinecraftPacket packet) {
ConnectedPlayer connected = (ConnectedPlayer) player; ConnectedPlayer connected = (ConnectedPlayer) player;
connected.getMinecraftConnection().write(packet); connected.getConnection().write(packet);
} }
} }