(1.3.1) Fix java players on MC 1.13+ kicked by EaglerXBungee

This commit is contained in:
lax1dude 2024-09-24 20:37:53 -07:00
parent 12b8177f5e
commit daf4cec182
10 changed files with 61 additions and 18 deletions

View File

@ -44,6 +44,7 @@ The settings.yml file is primarily used for configuring the built-in skin and ca
- **`disable_fnaw_skins_everywhere:`** Boolean, default value is `false`, can be used to globally disable FNAW skins if your players bitch about them a lot and are too lazy to just disable the FNAW skins locally on their clients. - **`disable_fnaw_skins_everywhere:`** Boolean, default value is `false`, can be used to globally disable FNAW skins if your players bitch about them a lot and are too lazy to just disable the FNAW skins locally on their clients.
- **`disable_fnaw_skins_on_servers:`** List of strings, default value is nothing (`[]`), contains a list of names of registered servers on your BungeeCord proxy that the FNAW skins should be disabled on. Good for explicitly disabling them for PVP but allowing them everywhere else. - **`disable_fnaw_skins_on_servers:`** List of strings, default value is nothing (`[]`), contains a list of names of registered servers on your BungeeCord proxy that the FNAW skins should be disabled on. Good for explicitly disabling them for PVP but allowing them everywhere else.
- **`enable_backend_rpc_api:`** Boolean, default value is `false`, if support for servers running the EaglerXBukkitAPI plugin should be enabled or not. - **`enable_backend_rpc_api:`** Boolean, default value is `false`, if support for servers running the EaglerXBukkitAPI plugin should be enabled or not.
- **use_modernized_channel_names:`** Boolean, default value is `false`, if "modernized" plugin channel names compatible with Minecraft 1.13+ should be used for EaglerXBukkitAPI plugin message packets
### `listeners.yml` ### `listeners.yml`

View File

@ -151,6 +151,8 @@ public class EaglerXBungee extends Plugin {
} }
getProxy().registerChannel(EaglerBackendRPCProtocol.CHANNEL_NAME); getProxy().registerChannel(EaglerBackendRPCProtocol.CHANNEL_NAME);
getProxy().registerChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_READY); getProxy().registerChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_READY);
getProxy().registerChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_MODERN);
getProxy().registerChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_READY_MODERN);
getProxy().registerChannel(EaglerPacketEventListener.GET_DOMAIN_CHANNEL); getProxy().registerChannel(EaglerPacketEventListener.GET_DOMAIN_CHANNEL);
startListeners(); startListeners();
if(closeInactiveConnections != null) { if(closeInactiveConnections != null) {
@ -242,6 +244,7 @@ public class EaglerXBungee extends Plugin {
@Override @Override
public void onDisable() { public void onDisable() {
stopListeners();
PluginManager mgr = getProxy().getPluginManager(); PluginManager mgr = getProxy().getPluginManager();
mgr.unregisterListeners(this); mgr.unregisterListeners(this);
mgr.unregisterCommands(this); mgr.unregisterCommands(this);
@ -250,8 +253,9 @@ public class EaglerXBungee extends Plugin {
} }
getProxy().unregisterChannel(EaglerBackendRPCProtocol.CHANNEL_NAME); getProxy().unregisterChannel(EaglerBackendRPCProtocol.CHANNEL_NAME);
getProxy().unregisterChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_READY); getProxy().unregisterChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_READY);
getProxy().unregisterChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_MODERN);
getProxy().unregisterChannel(EaglerBackendRPCProtocol.CHANNEL_NAME_READY_MODERN);
getProxy().unregisterChannel(EaglerPacketEventListener.GET_DOMAIN_CHANNEL); getProxy().unregisterChannel(EaglerPacketEventListener.GET_DOMAIN_CHANNEL);
stopListeners();
if(closeInactiveConnections != null) { if(closeInactiveConnections != null) {
closeInactiveConnections.cancel(); closeInactiveConnections.cancel();
closeInactiveConnections = null; closeInactiveConnections = null;
@ -264,10 +268,14 @@ public class EaglerXBungee extends Plugin {
updateServiceTasks.cancel(); updateServiceTasks.cancel();
updateServiceTasks = null; updateServiceTasks = null;
} }
skinService.shutdown(); if(skinService != null) {
skinService = null; skinService.shutdown();
capeService.shutdown(); skinService = null;
capeService = null; }
if(capeService != null) {
capeService.shutdown();
capeService = null;
}
if(defaultAuthSystem != null) { if(defaultAuthSystem != null) {
defaultAuthSystem.destroy(); defaultAuthSystem.destroy();
defaultAuthSystem = null; defaultAuthSystem = null;

View File

@ -190,6 +190,7 @@ public class EaglerBungeeConfig {
boolean disableFNAWSkinsEverywhere = configYml.getBoolean("disable_fnaw_skins_everywhere", false); boolean disableFNAWSkinsEverywhere = configYml.getBoolean("disable_fnaw_skins_everywhere", false);
Set<String> disableFNAWSkinsOnServers = new HashSet<>((Collection<String>)configYml.getList("disable_fnaw_skins_on_servers")); Set<String> disableFNAWSkinsOnServers = new HashSet<>((Collection<String>)configYml.getList("disable_fnaw_skins_on_servers"));
boolean enableBackendRPCAPI = configYml.getBoolean("enable_backend_rpc_api", false); boolean enableBackendRPCAPI = configYml.getBoolean("enable_backend_rpc_api", false);
boolean useModernizedChannelNames = configYml.getBoolean("use_modernized_channel_names", false);
final EaglerBungeeConfig ret = new EaglerBungeeConfig(serverName, serverUUID, websocketKeepAliveTimeout, final EaglerBungeeConfig ret = new EaglerBungeeConfig(serverName, serverUUID, websocketKeepAliveTimeout,
websocketHandshakeTimeout, builtinHttpServerTimeout, websocketCompressionLevel, serverListeners, websocketHandshakeTimeout, builtinHttpServerTimeout, websocketCompressionLevel, serverListeners,
@ -197,7 +198,8 @@ public class EaglerBungeeConfig {
skinRateLimitPlayer, skinRateLimitGlobal, skinCacheURI, keepObjectsDays, keepProfilesDays, maxObjects, skinRateLimitPlayer, skinRateLimitGlobal, skinCacheURI, keepObjectsDays, keepProfilesDays, maxObjects,
maxProfiles, antagonistsRateLimit, sqliteDriverClass, sqliteDriverPath, eaglerPlayersVanillaSkin, maxProfiles, antagonistsRateLimit, sqliteDriverClass, sqliteDriverPath, eaglerPlayersVanillaSkin,
enableIsEaglerPlayerProperty, authConfig, updatesConfig, iceServers, voiceChat, disableVoiceOnServers, enableIsEaglerPlayerProperty, authConfig, updatesConfig, iceServers, voiceChat, disableVoiceOnServers,
disableFNAWSkinsEverywhere, disableFNAWSkinsOnServers, enableBackendRPCAPI, pauseMenuConfig); disableFNAWSkinsEverywhere, disableFNAWSkinsOnServers, enableBackendRPCAPI, useModernizedChannelNames,
pauseMenuConfig);
if(eaglerPlayersVanillaSkin != null) { if(eaglerPlayersVanillaSkin != null) {
VanillaDefaultSkinProfileLoader.lookupVanillaSkinUser(ret); VanillaDefaultSkinProfileLoader.lookupVanillaSkinUser(ret);
@ -333,6 +335,7 @@ public class EaglerBungeeConfig {
private final boolean disableFNAWSkinsEverywhere; private final boolean disableFNAWSkinsEverywhere;
private final Set<String> disableFNAWSkinsOnServers; private final Set<String> disableFNAWSkinsOnServers;
private final boolean enableBackendRPCAPI; private final boolean enableBackendRPCAPI;
private final boolean useModernizedChannelNames;
private final EaglerPauseMenuConfig pauseMenuConf; private final EaglerPauseMenuConfig pauseMenuConf;
private boolean isCrackedFlag; private boolean isCrackedFlag;
Property[] eaglerPlayersVanillaSkinCached = new Property[] { isEaglerProperty }; Property[] eaglerPlayersVanillaSkinCached = new Property[] { isEaglerProperty };
@ -504,6 +507,10 @@ public class EaglerBungeeConfig {
return enableBackendRPCAPI; return enableBackendRPCAPI;
} }
public boolean getUseModernizedChannelNames() {
return useModernizedChannelNames;
}
public EaglerPauseMenuConfig getPauseMenuConf() { public EaglerPauseMenuConfig getPauseMenuConf() {
return pauseMenuConf; return pauseMenuConf;
} }
@ -518,7 +525,7 @@ public class EaglerBungeeConfig {
boolean enableIsEaglerPlayerProperty, EaglerAuthConfig authConfig, EaglerUpdateConfig updateConfig, boolean enableIsEaglerPlayerProperty, EaglerAuthConfig authConfig, EaglerUpdateConfig updateConfig,
Collection<String> iceServers, boolean enableVoiceChat, Set<String> disableVoiceOnServers, Collection<String> iceServers, boolean enableVoiceChat, Set<String> disableVoiceOnServers,
boolean disableFNAWSkinsEverywhere, Set<String> disableFNAWSkinsOnServers, boolean disableFNAWSkinsEverywhere, Set<String> disableFNAWSkinsOnServers,
boolean enableBackendRPCAPI, EaglerPauseMenuConfig pauseMenuConf) { boolean enableBackendRPCAPI, boolean useModernizedChannelNames, EaglerPauseMenuConfig pauseMenuConf) {
this.serverName = serverName; this.serverName = serverName;
this.serverUUID = serverUUID; this.serverUUID = serverUUID;
this.serverListeners = serverListeners; this.serverListeners = serverListeners;
@ -551,6 +558,7 @@ public class EaglerBungeeConfig {
this.disableFNAWSkinsEverywhere = disableFNAWSkinsEverywhere; this.disableFNAWSkinsEverywhere = disableFNAWSkinsEverywhere;
this.disableFNAWSkinsOnServers = disableFNAWSkinsOnServers; this.disableFNAWSkinsOnServers = disableFNAWSkinsOnServers;
this.enableBackendRPCAPI = enableBackendRPCAPI; this.enableBackendRPCAPI = enableBackendRPCAPI;
this.useModernizedChannelNames = useModernizedChannelNames;
this.pauseMenuConf = pauseMenuConf; this.pauseMenuConf = pauseMenuConf;
} }

View File

@ -81,12 +81,12 @@ public class EaglerPacketEventListener implements Listener {
} }
} }
} }
if(tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME)) { if(tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME) || tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME_MODERN)) {
event.getSender().disconnect(new TextComponent("Nope!")); event.getSender().disconnect(new TextComponent("Nope!"));
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if(tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME_READY)) { if(tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME_READY) || tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME_READY_MODERN)) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -95,7 +95,7 @@ public class EaglerPacketEventListener implements Listener {
String tag = event.getTag(); String tag = event.getTag();
if(player.getPendingConnection() instanceof EaglerInitialHandler) { if(player.getPendingConnection() instanceof EaglerInitialHandler) {
EaglerInitialHandler initialHandler = (EaglerInitialHandler)player.getPendingConnection(); EaglerInitialHandler initialHandler = (EaglerInitialHandler)player.getPendingConnection();
if(EaglerBackendRPCProtocol.CHANNEL_NAME.equals(tag)) { if(EaglerBackendRPCProtocol.CHANNEL_NAME.equals(tag) || tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME_MODERN)) {
event.setCancelled(true); event.setCancelled(true);
try { try {
initialHandler.handleBackendRPCPacket((Server)event.getSender(), event.getData()); initialHandler.handleBackendRPCPacket((Server)event.getSender(), event.getData());
@ -113,7 +113,7 @@ public class EaglerPacketEventListener implements Listener {
} }
} }
}else { }else {
if(EaglerBackendRPCProtocol.CHANNEL_NAME.equals(tag)) { if(EaglerBackendRPCProtocol.CHANNEL_NAME.equals(tag) || tag.equals(EaglerBackendRPCProtocol.CHANNEL_NAME_MODERN)) {
event.setCancelled(true); event.setCancelled(true);
try { try {
BackendRPCSessionHandler.handlePacketOnVanilla((Server) event.getSender(), BackendRPCSessionHandler.handlePacketOnVanilla((Server) event.getSender(),

View File

@ -37,6 +37,7 @@ import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.api.EaglerXBungee
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.config.EaglerBungeeConfig; import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.config.EaglerBungeeConfig;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.config.EaglerListenerConfig; import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.config.EaglerListenerConfig;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.EaglerInitialHandler.ClientCertificateHolder; import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.EaglerInitialHandler.ClientCertificateHolder;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.backend_rpc_protocol.BackendRPCSessionHandler;
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.web.HttpWebServer; import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.web.HttpWebServer;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.pkt.GameMessagePacket; import net.lax1dude.eaglercraft.v1_8.socket.protocol.pkt.GameMessagePacket;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.pkt.server.SPacketEnableFNAWSkinsEAG; import net.lax1dude.eaglercraft.v1_8.socket.protocol.pkt.server.SPacketEnableFNAWSkinsEAG;
@ -295,7 +296,7 @@ public class EaglerPipeline {
private static void handleServerConnectionReady(UserConnection userConnection) { private static void handleServerConnectionReady(UserConnection userConnection) {
try { try {
ServerConnection server = userConnection.getServer(); ServerConnection server = userConnection.getServer();
server.sendData(EaglerBackendRPCProtocol.CHANNEL_NAME_READY, ArrayUtils.EMPTY_BYTE_ARRAY); server.sendData(BackendRPCSessionHandler.getReadyChNameFor(server), ArrayUtils.EMPTY_BYTE_ARRAY);
if(userConnection.getPendingConnection() instanceof EaglerInitialHandler) { if(userConnection.getPendingConnection() instanceof EaglerInitialHandler) {
EaglerInitialHandler handler = (EaglerInitialHandler) userConnection.getPendingConnection(); EaglerInitialHandler handler = (EaglerInitialHandler) userConnection.getPendingConnection();
ServerInfo sv = server.getInfo(); ServerInfo sv = server.getInfo();

View File

@ -27,6 +27,7 @@ import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.server.EaglerInit
import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.voice.VoiceService; import net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.voice.VoiceService;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.util.ReusableByteArrayInputStream; import net.lax1dude.eaglercraft.v1_8.socket.protocol.util.ReusableByteArrayInputStream;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.util.ReusableByteArrayOutputStream; import net.lax1dude.eaglercraft.v1_8.socket.protocol.util.ReusableByteArrayOutputStream;
import net.md_5.bungee.ServerConnection;
import net.md_5.bungee.UserConnection; import net.md_5.bungee.UserConnection;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.connection.Server;
@ -54,6 +55,7 @@ public class BackendRPCSessionHandler {
protected final EaglerInitialHandler eaglerHandler; protected final EaglerInitialHandler eaglerHandler;
private Server currentServer = null; private Server currentServer = null;
private String channelName = null;
private EaglerBackendRPCProtocol currentProtocol = null; private EaglerBackendRPCProtocol currentProtocol = null;
private EaglerBackendRPCHandler currentHandler = null; private EaglerBackendRPCHandler currentHandler = null;
private int subscribedEvents = 0; private int subscribedEvents = 0;
@ -150,7 +152,7 @@ public class BackendRPCSessionHandler {
+ packet.getClass().getSimpleName() + " was the wrong length for user \"" + packet.getClass().getSimpleName() + " was the wrong length for user \""
+ eaglerHandler.getName() + "\" after serialization: " + ret.length + " != " + len); + eaglerHandler.getName() + "\" after serialization: " + ret.length + " != " + len);
} }
server.sendData(EaglerBackendRPCProtocol.CHANNEL_NAME, ret); server.sendData(channelName, ret);
} }
public void handleConnectionLost(ServerInfo server) { public void handleConnectionLost(ServerInfo server) {
@ -161,6 +163,7 @@ public class BackendRPCSessionHandler {
private void handleDestroyContext() { private void handleDestroyContext() {
currentServer = null; currentServer = null;
channelName = null;
currentProtocol = null; currentProtocol = null;
currentHandler = null; currentHandler = null;
subscribedEvents = 0; subscribedEvents = 0;
@ -178,6 +181,7 @@ public class BackendRPCSessionHandler {
if(!(packet instanceof CPacketRPCEnabled)) { if(!(packet instanceof CPacketRPCEnabled)) {
throw new WrongRPCPacketException(); throw new WrongRPCPacketException();
} }
channelName = getChNameFor((ServerConnection)server);
if(!ArrayUtils.contains(((CPacketRPCEnabled)packet).supportedProtocols, EaglerBackendRPCProtocol.V1.vers)) { if(!ArrayUtils.contains(((CPacketRPCEnabled)packet).supportedProtocols, EaglerBackendRPCProtocol.V1.vers)) {
EaglerXBungee.logger().severe("[" + eaglerHandler.getSocketAddress() EaglerXBungee.logger().severe("[" + eaglerHandler.getSocketAddress()
+ "]: Unsupported backend RPC protocol version for user \"" + eaglerHandler.getName() + "\""); + "]: Unsupported backend RPC protocol version for user \"" + eaglerHandler.getName() + "\"");
@ -217,7 +221,7 @@ public class BackendRPCSessionHandler {
EaglerXBungee.logger().severe("(Note: this player is not using Eaglercraft!)"); EaglerXBungee.logger().severe("(Note: this player is not using Eaglercraft!)");
return; return;
} }
server.sendData(EaglerBackendRPCProtocol.CHANNEL_NAME, bao.toByteArray()); server.sendData(getChNameFor((ServerConnection)server), bao.toByteArray());
return; return;
} }
EaglerXBungee.logger().warning("[" + player.getSocketAddress() EaglerXBungee.logger().warning("[" + player.getSocketAddress()
@ -232,7 +236,7 @@ public class BackendRPCSessionHandler {
+ "]: Failed to write backend RPC protocol version for user \"" + player.getName() + "\"", ex); + "]: Failed to write backend RPC protocol version for user \"" + player.getName() + "\"", ex);
return; return;
} }
server.sendData(EaglerBackendRPCProtocol.CHANNEL_NAME, bao.toByteArray()); server.sendData(getChNameFor((ServerConnection)server), bao.toByteArray());
} }
public void setSubscribedEvents(int eventsToEnable) { public void setSubscribedEvents(int eventsToEnable) {
@ -292,4 +296,24 @@ public class BackendRPCSessionHandler {
} }
} }
private static int getVerSafe(ServerConnection server) {
try {
return server.getCh().getEncodeVersion();
}catch(Throwable t) {
return -1;
}
}
public static String getChNameFor(ServerConnection server) {
return (EaglerXBungee.getEagler().getConfig().getUseModernizedChannelNames() || getVerSafe(server) >= 393)
? EaglerBackendRPCProtocol.CHANNEL_NAME_MODERN
: EaglerBackendRPCProtocol.CHANNEL_NAME;
}
public static String getReadyChNameFor(ServerConnection server) {
return (EaglerXBungee.getEagler().getConfig().getUseModernizedChannelNames() || getVerSafe(server) >= 393)
? EaglerBackendRPCProtocol.CHANNEL_NAME_READY_MODERN
: EaglerBackendRPCProtocol.CHANNEL_NAME_READY;
}
} }

View File

@ -24,4 +24,5 @@ enable_is_eagler_player_property: true
disable_voice_chat_on_servers: [] disable_voice_chat_on_servers: []
disable_fnaw_skins_everywhere: false disable_fnaw_skins_everywhere: false
disable_fnaw_skins_on_servers: [] disable_fnaw_skins_on_servers: []
enable_backend_rpc_api: false enable_backend_rpc_api: false
use_modernized_channel_names: false

View File

@ -1,5 +1,5 @@
name: EaglercraftXBungee name: EaglercraftXBungee
main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee main: net.lax1dude.eaglercraft.v1_8.plugin.gateway_bungeecord.EaglerXBungee
version: 1.3.0 version: 1.3.1
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 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
author: lax1dude author: lax1dude

View File

@ -1 +1 @@
1.3.0 1.3.1