![JAR search and dependency download from the Maven repository](/logo.png)
net.minestom.server.network.packet.client.play.ClientEditBookPacket Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
package net.minestom.server.network.packet.client.play;
import net.minestom.server.network.NetworkBuffer;
import net.minestom.server.network.packet.client.ClientPacket;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import static net.minestom.server.network.NetworkBuffer.STRING;
import static net.minestom.server.network.NetworkBuffer.VAR_INT;
public record ClientEditBookPacket(int slot, @NotNull List pages,
@Nullable String title) implements ClientPacket {
public static final int MAX_PAGES = 200;
public ClientEditBookPacket {
pages = List.copyOf(pages);
if (title != null && title.length() > 128) {
throw new IllegalArgumentException("Title length cannot be greater than 128");
}
}
public ClientEditBookPacket(@NotNull NetworkBuffer reader) {
this(reader.read(VAR_INT), reader.readCollection(STRING, MAX_PAGES),
reader.readOptional(STRING));
}
@Override
public void write(@NotNull NetworkBuffer writer) {
writer.write(VAR_INT, slot);
writer.writeCollection(STRING, pages);
writer.writeOptional(STRING, title);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy