File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
src/de/javasocketapi/core Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,9 @@ public void run() {
4646 outputStream .write (bytes );
4747 outputStream .flush ();
4848 }
49+ Thread .sleep (0 , 1 );
4950 }
50- } catch (IOException e ) {
51+ } catch (IOException | InterruptedException e ) {
5152 e .printStackTrace ();
5253 }
5354 }
Original file line number Diff line number Diff line change 11package de .javasocketapi .core ;
22
3- import org .reflections .Reflections ;
4-
53import java .util .ArrayList ;
64import java .util .List ;
75
8- class PacketRegistry {
6+ public class PacketRegistry {
7+
8+ private static List <Class <? extends Packet >> registerdPackets = new ArrayList <>();
99
10- private static List <Class <? extends Packet >> registerdPackets ;
10+ static int indexOf (Class <? extends Packet > packetClass ) {
11+ return PacketRegistry .registerdPackets .indexOf (packetClass );
12+ }
1113
12- public static int indexOf ( Class <? extends Packet > packetClass ) {
13- return registerdPackets .indexOf ( packetClass );
14+ static Class <? extends Packet > get ( int index ) {
15+ return PacketRegistry . registerdPackets .get ( index );
1416 }
1517
16- public static Class <? extends Packet > get ( int index ) {
17- return registerdPackets .get ( index );
18+ public static void registerPacket ( Class <? extends Packet > packetClass ) {
19+ PacketRegistry . registerdPackets .add ( packetClass );
1820 }
1921
20- static {
21- Reflections reflections = new Reflections ();
22- PacketRegistry .registerdPackets = new ArrayList <>(reflections .getSubTypesOf (Packet .class ));
22+ public static void registerPackets (List <Class <? extends Packet >> packetClasses ) {
23+ PacketRegistry .registerdPackets .addAll (packetClasses );
2324 }
2425
2526}
You can’t perform that action at this time.
0 commit comments