geforkt von Mirrors/Velocity
Merge pull request #83 from dualspiral/fix/fml-plugin-messages
Only send FML/FML|MP plugin messages if the player has joined the server
Dieser Commit ist enthalten in:
Commit
656987db03
@ -8,6 +8,8 @@ public class VelocityConstants {
|
|||||||
public static final String VELOCITY_IP_FORWARDING_CHANNEL = "velocity:player_info";
|
public static final String VELOCITY_IP_FORWARDING_CHANNEL = "velocity:player_info";
|
||||||
|
|
||||||
public static final String FORGE_LEGACY_HANDSHAKE_CHANNEL = "FML|HS";
|
public static final String FORGE_LEGACY_HANDSHAKE_CHANNEL = "FML|HS";
|
||||||
|
public static final String FORGE_LEGACY_CHANNEL = "FML";
|
||||||
|
public static final String FORGE_MULTIPART_LEGACY_CHANNEL = "FML|MP";
|
||||||
|
|
||||||
public static final byte[] FORGE_LEGACY_HANDSHAKE_RESET_DATA = new byte[] { -2, 0 };
|
public static final byte[] FORGE_LEGACY_HANDSHAKE_RESET_DATA = new byte[] { -2, 0 };
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,12 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
|
|||||||
minecraftConnection.write(login);
|
minecraftConnection.write(login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void writeIfJoined(PluginMessage message) {
|
||||||
|
if (hasCompletedJoin) {
|
||||||
|
minecraftConnection.write(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public MinecraftConnection getMinecraftConnection() {
|
public MinecraftConnection getMinecraftConnection() {
|
||||||
return minecraftConnection;
|
return minecraftConnection;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.velocitypowered.api.event.connection.DisconnectEvent;
|
|||||||
import com.velocitypowered.api.proxy.messages.ChannelSide;
|
import com.velocitypowered.api.proxy.messages.ChannelSide;
|
||||||
import com.velocitypowered.api.proxy.messages.MessageHandler;
|
import com.velocitypowered.api.proxy.messages.MessageHandler;
|
||||||
import com.velocitypowered.proxy.VelocityServer;
|
import com.velocitypowered.proxy.VelocityServer;
|
||||||
|
import com.velocitypowered.proxy.connection.VelocityConstants;
|
||||||
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
import com.velocitypowered.proxy.connection.backend.VelocityServerConnection;
|
||||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||||
import com.velocitypowered.proxy.protocol.ProtocolConstants;
|
import com.velocitypowered.proxy.protocol.ProtocolConstants;
|
||||||
@ -285,8 +286,18 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
MessageHandler.ForwardStatus status = server.getChannelRegistrar().handlePluginMessage(player,
|
MessageHandler.ForwardStatus status = server.getChannelRegistrar().handlePluginMessage(player,
|
||||||
ChannelSide.FROM_CLIENT, packet);
|
ChannelSide.FROM_CLIENT, packet);
|
||||||
if (status == MessageHandler.ForwardStatus.FORWARD) {
|
if (status == MessageHandler.ForwardStatus.FORWARD) {
|
||||||
|
String channel = packet.getChannel();
|
||||||
|
|
||||||
// We're going to forward on the original packet.
|
// We're going to forward on the original packet.
|
||||||
player.getConnectedServer().getMinecraftConnection().write(packet);
|
//
|
||||||
|
// If we have Forge messages, we may need to drop them if the server switch has
|
||||||
|
// not completed yet.
|
||||||
|
if (channel.equals(VelocityConstants.FORGE_LEGACY_CHANNEL)
|
||||||
|
|| channel.equals(VelocityConstants.FORGE_MULTIPART_LEGACY_CHANNEL)) {
|
||||||
|
player.getConnectedServer().writeIfJoined(packet);
|
||||||
|
} else {
|
||||||
|
player.getConnectedServer().getMinecraftConnection().write(packet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren