Skip to content

Commit 0f20281

Browse files
committed
add UpdateReadTimeoutPacket, update bungeecord api
1 parent c723890 commit 0f20281

File tree

4 files changed

+77
-2
lines changed

4 files changed

+77
-2
lines changed

core/src/main/java/net/labymod/serverapi/core/AbstractLabyModPlayer.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import net.labymod.serverapi.core.packet.clientbound.game.moderation.PermissionPacket;
5454
import net.labymod.serverapi.core.packet.clientbound.game.supplement.InputPromptPacket;
5555
import net.labymod.serverapi.core.packet.clientbound.game.supplement.ServerSwitchPromptPacket;
56+
import net.labymod.serverapi.core.packet.clientbound.game.supplement.UpdateReadTimeoutPacket;
5657
import net.labymod.serverapi.core.packet.serverbound.game.moderation.AddonRecommendationResponsePacket;
5758
import net.labymod.serverapi.core.packet.serverbound.game.supplement.InputPromptResponsePacket;
5859
import net.labymod.serverapi.core.packet.serverbound.game.supplement.ServerSwitchPromptResponsePacket;
@@ -441,6 +442,15 @@ public void sendTabListBanner(@Nullable String iconUrl) {
441442
this.sendLabyModPacket(new TabListBannerPacket(iconUrl));
442443
}
443444

445+
/**
446+
* Update read timeout of player
447+
*
448+
* @param seconds The read timeout of the client in seconds
449+
*/
450+
public void updateReadTimeout(int seconds) {
451+
this.sendLabyModPacket(new UpdateReadTimeoutPacket(seconds));
452+
}
453+
444454
/**
445455
* Sends the provided packet to the player
446456
*

core/src/main/java/net/labymod/serverapi/core/LabyModProtocol.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import net.labymod.serverapi.core.packet.clientbound.game.moderation.PermissionPacket;
4444
import net.labymod.serverapi.core.packet.clientbound.game.supplement.InputPromptPacket;
4545
import net.labymod.serverapi.core.packet.clientbound.game.supplement.ServerSwitchPromptPacket;
46+
import net.labymod.serverapi.core.packet.clientbound.game.supplement.UpdateReadTimeoutPacket;
4647
import net.labymod.serverapi.core.packet.serverbound.game.feature.marker.ClientAddMarkerPacket;
4748
import net.labymod.serverapi.core.packet.serverbound.game.moderation.AddonRecommendationResponsePacket;
4849
import net.labymod.serverapi.core.packet.serverbound.game.moderation.AddonStateChangedPacket;
@@ -91,5 +92,6 @@ private void registerPackets() {
9192
this.registerPacket(33, InstalledAddonsRequestPacket.class, Direction.CLIENTBOUND);
9293
this.registerPacket(34, InstalledAddonsResponsePacket.class, Direction.SERVERBOUND);
9394
this.registerPacket(35, AddonStateChangedPacket.class, Direction.SERVERBOUND);
95+
this.registerPacket(36, UpdateReadTimeoutPacket.class, Direction.CLIENTBOUND);
9496
}
9597
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2025 LabyMedia GmbH
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
package net.labymod.serverapi.core.packet.clientbound.game.supplement;
26+
27+
import net.labymod.serverapi.api.packet.IdentifiablePacket;
28+
import net.labymod.serverapi.api.payload.io.PayloadReader;
29+
import net.labymod.serverapi.api.payload.io.PayloadWriter;
30+
import org.jetbrains.annotations.NotNull;
31+
32+
public class UpdateReadTimeoutPacket extends IdentifiablePacket {
33+
34+
private int seconds;
35+
36+
public UpdateReadTimeoutPacket(int seconds) {
37+
this.seconds = Math.max(1, seconds);
38+
}
39+
40+
@Override
41+
public void read(@NotNull PayloadReader reader) {
42+
super.read(reader);
43+
this.seconds = Math.max(1, reader.readVarInt());
44+
}
45+
46+
@Override
47+
public void write(@NotNull PayloadWriter writer) {
48+
super.write(writer);
49+
writer.writeVarInt(this.seconds);
50+
}
51+
52+
public int getSeconds() {
53+
return this.seconds;
54+
}
55+
56+
@Override
57+
public String toString() {
58+
return "UpdateReadTimeoutPacket{" +
59+
"seconds=" + this.seconds +
60+
'}';
61+
}
62+
}

server/bungeecord/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ plugins {
33
}
44

55
repositories {
6-
maven("https://oss.sonatype.org/content/repositories/snapshots")
6+
maven("https://oss.sonatype.org/content/groups/public/")
7+
maven("https://libraries.minecraft.net/")
78
}
89

910
dependencies {
1011
// this is the oldest available version of LabyMod 4. As of 1.20.6 nothing broke, so this should be fine.
11-
compileOnly("net.md-5:bungeecord-api:1.8-SNAPSHOT")
12+
compileOnly("net.md-5:bungeecord-api:1.21-R0.4")
1213
}
1314

1415
tasks.processResources {

0 commit comments

Comments
 (0)