-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement: Change to using functional interfaces for clientbound pa…
…cket handling (#29)
- Loading branch information
Showing
8 changed files
with
16 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 4 additions & 21 deletions
25
src/main/java/net/hypixel/modapi/handler/ClientboundPacketHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,8 @@ | ||
package net.hypixel.modapi.handler; | ||
|
||
import net.hypixel.modapi.packet.impl.clientbound.ClientboundHelloPacket; | ||
import net.hypixel.modapi.packet.impl.clientbound.ClientboundPartyInfoPacket; | ||
import net.hypixel.modapi.packet.impl.clientbound.ClientboundPingPacket; | ||
import net.hypixel.modapi.packet.impl.clientbound.ClientboundPlayerInfoPacket; | ||
import net.hypixel.modapi.packet.impl.clientbound.event.ClientboundLocationPacket; | ||
import net.hypixel.modapi.packet.ClientboundHypixelPacket; | ||
|
||
public interface ClientboundPacketHandler { | ||
|
||
default void onHelloEvent(ClientboundHelloPacket packet) { | ||
} | ||
|
||
default void onPingPacket(ClientboundPingPacket packet) { | ||
} | ||
|
||
default void onPartyInfoPacket(ClientboundPartyInfoPacket packet) { | ||
} | ||
|
||
default void onPlayerInfoPacket(ClientboundPlayerInfoPacket packet) { | ||
} | ||
|
||
default void onLocationEvent(ClientboundLocationPacket packet) { | ||
} | ||
@FunctionalInterface | ||
public interface ClientboundPacketHandler<T extends ClientboundHypixelPacket> { | ||
void handle(T packet); | ||
} |
5 changes: 0 additions & 5 deletions
5
src/main/java/net/hypixel/modapi/packet/ClientboundHypixelPacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
package net.hypixel.modapi.packet; | ||
|
||
import net.hypixel.modapi.handler.ClientboundPacketHandler; | ||
|
||
public interface ClientboundHypixelPacket extends HypixelPacket { | ||
|
||
void handle(ClientboundPacketHandler handler); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters