Skip to content

Commit

Permalink
Make changes to packet handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Martin committed Jun 9, 2024
1 parent 7de82c0 commit 3c45313
Show file tree
Hide file tree
Showing 25 changed files with 120 additions and 700 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.IPacket;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketIdentification;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketParameter;
import group.aelysium.rustyconnector.toolkit.mc_loader.central.IMCLoaderFlame;
import org.jetbrains.annotations.NotNull;

import java.util.*;
Expand Down Expand Up @@ -211,7 +210,7 @@ public void replyTo(IPacket targetPacket) {
* Identification is what differentiates a "Server ping packet" from a "Teleport player packet"
*/
public ReadyForSending identification(PacketIdentification id) {
return new ReadyForSending(this.flame, builder.identification(id));
return new ReadyForSending(builder.identification(id));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package group.aelysium.rustyconnector.common.packets;

import group.aelysium.central.MCLoaderFlame;
import group.aelysium.rustyconnector.toolkit.common.packet.Packet;
import group.aelysium.rustyconnector.common.magic_link.Packet;

public interface MCLoader {
class Lock extends Packet.Wrapper {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package group.aelysium.rustyconnector.common.packets;

import group.aelysium.rustyconnector.toolkit.common.packet.Packet;
import group.aelysium.rustyconnector.common.magic_link.Packet;

import java.util.ArrayList;
import java.util.List;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,22 @@
import group.aelysium.central.MCLoaderTinder;
import group.aelysium.lib.magic_link.MagicLink;
import group.aelysium.rustyconnector.toolkit.common.logger.PluginLogger;
import group.aelysium.rustyconnector.toolkit.common.packet.Packet;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketIdentification;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.IPacket;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketListener;
import group.aelysium.rustyconnector.toolkit.mc_loader.central.IMCLoaderTinder;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;

public class HandshakeFailureListener extends PacketListener<group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Failure> {
protected IMCLoaderTinder api;

public HandshakeFailureListener(IMCLoaderTinder api) {
this.api = api;
}

@Override
public PacketIdentification target() {
return BuiltInIdentifications.MAGICLINK_HANDSHAKE_FAIL;
}

@Override
public group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Failure wrap(Packet packet) {
return new group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Failure(packet);
public HandshakeFailureListener() {
super(
BuiltInIdentifications.MAGICLINK_HANDSHAKE_FAIL,
new Wrapper<>() {
@Override
public group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Failure wrap(IPacket packet) {
return new group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Failure(packet);
}
}
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
package group.aelysium.lib.magic_link.handlers;

import group.aelysium.rustyconnector.common.magic_link.Packet;
import group.aelysium.rustyconnector.common.packets.BuiltInIdentifications;
import group.aelysium.central.MCLoaderTinder;
import group.aelysium.lib.magic_link.MagicLink;
import group.aelysium.lib.server_info.ServerInfoService;
import group.aelysium.rustyconnector.toolkit.common.logger.PluginLogger;
import group.aelysium.rustyconnector.toolkit.common.packet.Packet;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketIdentification;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.IPacket;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketListener;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketParameter;
import group.aelysium.rustyconnector.toolkit.mc_loader.central.IMCLoaderTinder;
import group.aelysium.rustyconnector.toolkit.mc_loader.events.magic_link.TimeoutEvent;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;

public class HandshakeStalePingListener extends PacketListener<group.aelysium.rustyconnector.common.packets.MagicLink.StalePing> {
protected IMCLoaderTinder api;

public HandshakeStalePingListener(IMCLoaderTinder api) {
this.api = api;
}

@Override
public PacketIdentification target() {
return BuiltInIdentifications.MAGICLINK_HANDSHAKE_STALE_PING;
}

@Override
public group.aelysium.rustyconnector.common.packets.MagicLink.StalePing wrap(Packet packet) {
return new group.aelysium.rustyconnector.common.packets.MagicLink.StalePing(packet);
public HandshakeStalePingListener() {
super(
BuiltInIdentifications.MAGICLINK_HANDSHAKE_STALE_PING,
new Wrapper<>() {
@Override
public group.aelysium.rustyconnector.common.packets.MagicLink.StalePing wrap(IPacket packet) {
return new group.aelysium.rustyconnector.common.packets.MagicLink.StalePing(packet);
}
}
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import group.aelysium.lib.lang.MCLoaderLang;
import group.aelysium.lib.ranked_game_interface.RankedGameInterfaceService;
import group.aelysium.rustyconnector.toolkit.common.logger.PluginLogger;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.IPacket;
import group.aelysium.rustyconnector.toolkit.common.packet.Packet;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketIdentification;
import group.aelysium.rustyconnector.toolkit.common.magic_link.packet.PacketListener;
Expand All @@ -14,20 +15,16 @@
import net.kyori.adventure.text.Component;

public class HandshakeSuccessListener extends PacketListener<group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Success> {
protected MCLoaderTinder api;

public HandshakeSuccessListener(MCLoaderTinder api) {
this.api = api;
}

@Override
public PacketIdentification target() {
return BuiltInIdentifications.MAGICLINK_HANDSHAKE_SUCCESS;
}

@Override
public group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Success wrap(Packet packet) {
return new group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Success(packet);
public HandshakeSuccessListener() {
super(
BuiltInIdentifications.MAGICLINK_HANDSHAKE_PING,
new Wrapper<>() {
@Override
public group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Success wrap(IPacket packet) {
return new group.aelysium.rustyconnector.common.packets.MagicLink.Handshake.Success(packet);
}
}
);
}

@Override
Expand Down
Loading

0 comments on commit 3c45313

Please sign in to comment.