Skip to content

Commit b2ffc97

Browse files
Add method to send multiple packets immediately (#319)
1 parent 1fc1dd5 commit b2ffc97

File tree

1 file changed

+7
-0
lines changed
  • bedrock-connection/src/main/java/org/cloudburstmc/protocol/bedrock

1 file changed

+7
-0
lines changed

bedrock-connection/src/main/java/org/cloudburstmc/protocol/bedrock/BedrockPeer.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ public void sendPacketImmediately(int senderClientId, int targetClientId, Bedroc
116116
this.channel.writeAndFlush(BedrockPacketWrapper.create(0, senderClientId, targetClientId, packet, null));
117117
}
118118

119+
public void sendPacketsImmediately(int senderClientId, int targetClientId, BedrockPacket... packets) {
120+
for (BedrockPacket packet : packets) {
121+
this.channel.write(BedrockPacketWrapper.create(0, senderClientId, targetClientId, packet, null));
122+
}
123+
this.channel.flush();
124+
}
125+
119126
public void enableEncryption(@NonNull SecretKey secretKey) {
120127
Objects.requireNonNull(secretKey, "secretKey");
121128
if (!secretKey.getAlgorithm().equals("AES")) {

0 commit comments

Comments
 (0)