Skip to content

Commit d1e3984

Browse files
committed
add UpdateLabyModUserIndicatorVisibilityPacket
1 parent c29605d commit d1e3984

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,14 @@ public void bindBadges(List<ServerUserBadge> badges) {
464464
this.sendLabyModPacket(new ServerUserBadgePacket(badges));
465465
}
466466

467+
/**
468+
* Updates the visibility of the LabyMod user indicator
469+
* @param visible Whether the LabyMod user indicator should be visible
470+
*/
471+
public void updateLabyModUserIndicatorVisibility(boolean visible) {
472+
this.sendLabyModPacket(new UpdateLabyModUserIndicatorVisibilityPacket(visible));
473+
}
474+
467475
/**
468476
* Sends the provided packet to the player
469477
*

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,6 @@ private void registerPackets() {
9292
this.registerPacket(36, UpdateReadTimeoutPacket.class, Direction.CLIENTBOUND);
9393
this.registerPacket(37, ServerBadgePacket.class, Direction.CLIENTBOUND);
9494
this.registerPacket(38, ServerUserBadgePacket.class, Direction.CLIENTBOUND);
95+
this.registerPacket(39, UpdateLabyModUserIndicatorVisibilityPacket.class, Direction.CLIENTBOUND);
9596
}
9697
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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.feature;
26+
27+
import net.labymod.serverapi.api.packet.Packet;
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 UpdateLabyModUserIndicatorVisibilityPacket implements Packet {
33+
34+
private boolean visible;
35+
36+
public UpdateLabyModUserIndicatorVisibilityPacket(boolean visible) {
37+
this.visible = visible;
38+
}
39+
40+
@Override
41+
public void read(@NotNull PayloadReader reader) {
42+
this.visible = reader.readBoolean();
43+
}
44+
45+
@Override
46+
public void write(@NotNull PayloadWriter writer) {
47+
writer.writeBoolean(this.visible);
48+
}
49+
50+
public boolean isVisible() {
51+
return this.visible;
52+
}
53+
54+
@Override
55+
public String toString() {
56+
return "UpdateLabyModIndicatorVisibillityPacket{" +
57+
"visible=" + this.visible +
58+
'}';
59+
}
60+
}

0 commit comments

Comments
 (0)