<1.1.3> Fix protocol V4 flush issue in EaglerXVelocity

This commit is contained in:
lax1dude 2024-10-19 14:27:01 -07:00
parent 6a0a90f4ac
commit 85f4db5ac6
6 changed files with 32 additions and 11 deletions

View File

@ -17,13 +17,13 @@ package net.lax1dude.eaglercraft.v1_8.plugin.gateway_velocity;
*/
public class EaglerXVelocityVersion {
public static final String NATIVE_VELOCITY_BUILD = "3.3.0-SNAPSHOT:2016d148:b436";
public static final String NATIVE_VELOCITY_BUILD = "3.4.0-SNAPSHOT:99aaf3ce:b439";
public static final String ID = "EaglerXVelocity";
public static final String PLUGIN_ID = "eaglerxvelocity";
public static final String NAME = "EaglercraftXVelocity";
public static final String DESCRIPTION = "Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks";
public static final String VERSION = "1.1.2";
public static final String VERSION = "1.1.3";
public static final String[] AUTHORS = new String[] { "lax1dude", "ayunami2000" };
}

View File

@ -117,6 +117,7 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
private static final Constructor<LoginInboundConnection> stupid2Constructor;
private static final Method loginEventFiredMethod;
private static final Constructor<ConnectedPlayer> stupid3Constructor;
private static final Constructor<ConnectedPlayer> stupid3Constructor_new;
private static final Method setPermissionFunctionMethod;
private static final Field defaultPermissionsField;
private static final Constructor<InitialConnectSessionHandler> stupid4Constructor;
@ -134,8 +135,18 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
stupid2Constructor.setAccessible(true);
loginEventFiredMethod = LoginInboundConnection.class.getDeclaredMethod("loginEventFired", Runnable.class);
loginEventFiredMethod.setAccessible(true);
stupid3Constructor = ConnectedPlayer.class.getDeclaredConstructor(VelocityServer.class, GameProfile.class, MinecraftConnection.class, InetSocketAddress.class, boolean.class, IdentifiedKey.class);
stupid3Constructor.setAccessible(true);
Constructor<ConnectedPlayer> c3 = null;
Constructor<ConnectedPlayer> c3_new = null;
try {
c3_new = ConnectedPlayer.class.getDeclaredConstructor(VelocityServer.class, GameProfile.class, MinecraftConnection.class, InetSocketAddress.class, String.class, boolean.class, IdentifiedKey.class);
c3_new.setAccessible(true);
} catch (NoSuchMethodException e) {
c3 = ConnectedPlayer.class.getDeclaredConstructor(VelocityServer.class, GameProfile.class, MinecraftConnection.class, InetSocketAddress.class, boolean.class, IdentifiedKey.class);
c3.setAccessible(true);
c3_new = null;
}
stupid3Constructor = c3;
stupid3Constructor_new = c3_new;
setPermissionFunctionMethod = ConnectedPlayer.class.getDeclaredMethod("setPermissionFunction", PermissionFunction.class);
setPermissionFunctionMethod.setAccessible(true);
defaultPermissionsField = ConnectedPlayer.class.getDeclaredField("DEFAULT_PERMISSIONS");
@ -1069,10 +1080,18 @@ public class HttpWebSocketHandler extends ChannelInboundHandlerAdapter {
}
ConnectedPlayer player;
try {
player = stupid3Constructor.newInstance(bungee, gp, con, lic.getVirtualHost().orElse(null), false, lic.getIdentifiedKey());
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
if(stupid3Constructor_new != null) {
try {
player = stupid3Constructor_new.newInstance(bungee, gp, con, lic.getVirtualHost().orElse(null), lic.getRawVirtualHost().orElse(null), false, lic.getIdentifiedKey());
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}else {
try {
player = stupid3Constructor.newInstance(bungee, gp, con, lic.getVirtualHost().orElse(null), false, lic.getIdentifiedKey());
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
con.setAssociation(player);

View File

@ -237,8 +237,10 @@ public class GameProtocolMessageController {
pkt = sendQueueV4.remove(0);
sendPluginMessage(owner, GamePluginMessageConstants.V4_CHANNEL, pkt);
}else {
int i, j, sendCount = 0, totalLen = 0;
int i, j, sendCount, totalLen;
while(!sendQueueV4.isEmpty()) {
sendCount = 0;
totalLen = 0;
do {
i = sendQueueV4.get(sendCount++).length;
totalLen += GamePacketOutputBuffer.getVarIntSize(i) + i;

View File

@ -1 +1 @@
{"id":"eaglerxvelocity","name":"EaglercraftXVelocity","version":"1.1.2","description":"Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks","authors":["lax1dude", "ayunami2000"],"dependencies":[],"main":"net.lax1dude.eaglercraft.v1_8.plugin.gateway_velocity.EaglerXVelocity"}
{"id":"eaglerxvelocity","name":"EaglercraftXVelocity","version":"1.1.3","description":"Plugin to allow EaglercraftX 1.8 players to join your network, or allow EaglercraftX 1.8 players to use your network as a proxy to join other networks","authors":["lax1dude", "ayunami2000"],"dependencies":[],"main":"net.lax1dude.eaglercraft.v1_8.plugin.gateway_velocity.EaglerXVelocity"}

View File

@ -1 +1 @@
1.1.2
1.1.3