-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encrypt all packets except for first two packets
- Loading branch information
1 parent
32db7d3
commit 90d6bf7
Showing
44 changed files
with
976 additions
and
118 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
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
6 changes: 6 additions & 0 deletions
6
api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/PacketFlow.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package net.azisaba.azipluginmessaging.api.protocol; | ||
|
||
public enum PacketFlow { | ||
TO_PROXY, | ||
TO_SERVER, | ||
} |
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: 5 additions & 20 deletions
25
api/src/main/java/net/azisaba/azipluginmessaging/api/protocol/handler/MessageHandler.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,31 +1,16 @@ | ||
package net.azisaba.azipluginmessaging.api.protocol.handler; | ||
|
||
import net.azisaba.azipluginmessaging.api.protocol.message.Message; | ||
import net.azisaba.azipluginmessaging.api.server.ServerConnection; | ||
import net.azisaba.azipluginmessaging.api.server.PacketSender; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.io.DataInputStream; | ||
import java.io.IOException; | ||
|
||
/** | ||
* Represents a message handler which is responsible for decoding and handling the message. | ||
* @param <T> the message type | ||
*/ | ||
public interface MessageHandler<T extends Message> { | ||
/** | ||
* Decodes the message from the stream. | ||
* @param server The server connection. | ||
* @param in The stream. | ||
* @return The decoded message. | ||
* @throws IOException If an I/O error occurs. | ||
*/ | ||
@NotNull | ||
T read(@NotNull ServerConnection server, @NotNull DataInputStream in) throws IOException; | ||
|
||
/** | ||
* Handles the (decoded) message. | ||
* @param msg The message. | ||
* | ||
* @param sender The sender of the message. | ||
* @param msg The message. | ||
* @throws Exception If an exception occurs. | ||
*/ | ||
void handle(@NotNull T msg) throws Exception; | ||
void handle(@NotNull PacketSender sender, @NotNull T msg) throws Exception; | ||
} |
Oops, something went wrong.