aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hype/bbsentials/packets/PacketManager.java
diff options
context:
space:
mode:
authorHacktheTime <l4bg0jb7@duck.com>2023-10-12 20:17:28 +0200
committerHacktheTime <l4bg0jb7@duck.com>2023-10-12 20:17:28 +0200
commitdba4a297e295d68980da31264b0069fe9b18a13e (patch)
treec7e0a99968ef34509037f969ab7b1beba04a996d /src/main/java/de/hype/bbsentials/packets/PacketManager.java
parente111619d66346a2309b86a00420681f4cddf3cea (diff)
downloadBBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.tar.gz
BBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.tar.bz2
BBsentials-dba4a297e295d68980da31264b0069fe9b18a13e.zip
preperations to have a common code and different implementations for forge and fabric to ease up maintaining both versions
Diffstat (limited to 'src/main/java/de/hype/bbsentials/packets/PacketManager.java')
-rw-r--r--src/main/java/de/hype/bbsentials/packets/PacketManager.java53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/main/java/de/hype/bbsentials/packets/PacketManager.java b/src/main/java/de/hype/bbsentials/packets/PacketManager.java
deleted file mode 100644
index cda4315..0000000
--- a/src/main/java/de/hype/bbsentials/packets/PacketManager.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package de.hype.bbsentials.packets;
-
-import de.hype.bbsentials.communication.BBsentialConnection;
-import de.hype.bbsentials.packets.packets.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class PacketManager {
- private static List<Packet<? extends AbstractPacket>> packets = new ArrayList<>();
-
- public List<Packet<? extends AbstractPacket>> getPackets() {
- return packets;
- }
-
- // Define a map to store packet classes and their associated actions
- BBsentialConnection connection;
-
- // Method to initialize packet actions
- public PacketManager(BBsentialConnection connection) {
- this.connection = connection;
- initializePacketActions(connection);
- }
-
- public static void initializePacketActions(BBsentialConnection connection) {
- packets.add(new Packet<>(BingoChatMessagePacket.class, connection::onBingoChatMessagePacket));
- packets.add(new Packet<>(BroadcastMessagePacket.class, connection::onBroadcastMessagePacket));
- packets.add(new Packet<>(ChChestPacket.class, connection::onChChestPacket));
- packets.add(new Packet<>(DisconnectPacket.class, connection::onDisconnectPacket));
- packets.add(new Packet<>(DisplayTellrawMessagePacket.class, connection::onDisplayTellrawMessagePacket));
- packets.add(new Packet<>(InternalCommandPacket.class, connection::onInternalCommandPacket));
- packets.add(new Packet<>(InvalidCommandFeedbackPacket.class, connection::onInvalidCommandFeedbackPacket));
- packets.add(new Packet<>(MiningEventPacket.class, connection::onMiningEventPacket));
- packets.add(new Packet<>(PartyPacket.class, connection::onPartyPacket));
-// packets.add(new Packet<>(RequestConnectPacket.class, connection::dummy));
- packets.add(new Packet<>(SplashNotifyPacket.class, connection::onSplashNotifyPacket));
- packets.add(new Packet<>(SystemMessagePacket.class, connection::onSystemMessagePacket));
- packets.add(new Packet<>(WelcomeClientPacket.class, connection::onWelcomePacket));
- }
-
- // Method to handle a received packet
-
-
- // method to get a list of all packets
- public static List<Class<? extends AbstractPacket>> getAllPacketClasses() {
- initializePacketActions(null);
- List<Class<? extends AbstractPacket>> allPackets = new ArrayList<>();
- for (int i = 0; i < allPackets.size(); i++) {
- allPackets.add(packets.get(i).getClazz());
- }
- return allPackets;
- }
-}