Skip to content

Commit

Permalink
Ignore login packets sent by FML mods
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Sep 3, 2023
1 parent 4f4c8a7 commit 46fcf87
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public final class ServerLoginNetworkAddon extends AbstractNetworkAddon<ServerLo
private final QueryIdFactory queryIdFactory;
private final Collection<Future<?>> waits = new ConcurrentLinkedQueue<>();
private final Map<Integer, Identifier> channels = new ConcurrentHashMap<>();
private final Map<Integer, Identifier> ignoredChannels = new ConcurrentHashMap<>();
private boolean firstQueryTick = true;

public ServerLoginNetworkAddon(ServerLoginNetworkHandler handler) {
Expand Down Expand Up @@ -141,9 +140,7 @@ private boolean handle(int queryId, @Nullable PacketByteBuf originalBuf) {
Identifier channel = this.channels.remove(queryId);

if (channel == null) {
if (this.ignoredChannels.remove(queryId) == null) {
this.logger.warn("Query ID {} was received but no query has been associated in {}!", queryId, this.connection);
}
this.logger.warn("Query ID {} was received but no query has been associated in {}!", queryId, this.connection);
return false;
}

Expand Down Expand Up @@ -194,9 +191,8 @@ public void sendPacket(Packet<?> packet, PacketCallbacks callback) {
}

public void registerOutgoingPacket(LoginQueryRequestS2CPacket packet) {
// Ignore packets sent by FML
if (LoginWrapper.WRAPPER.equals(packet.getChannel())) {
this.ignoredChannels.put(packet.getQueryId(), packet.getChannel());
// Ignore packets sent by FML mods
if (ServerNetworkingImpl.LOGIN.getHandler(packet.getChannel()) == null) {
return;
}
this.channels.put(packet.getQueryId(), packet.getChannel());
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ fabric-client-tags-api-v1-version=1.1.1
loom.platform=forge
forge_version=1.20.1-47.1.3
pack_format=15
forgified_version=1.9.6
forgified_version=1.9.7
forge_fabric_loader_version=2.2.1+0.14.21+1.20.1

0 comments on commit 46fcf87

Please sign in to comment.