Handle server prefs

This commit is contained in:
Melledy 2024-03-28 01:10:34 -07:00
parent 1c2b2f7521
commit 27250070c1
5 changed files with 1046 additions and 0 deletions

View File

@ -0,0 +1,383 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;
import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedByte;
public final class ServerPrefsOuterClass {
/**
* Protobuf type {@code ServerPrefs}
*/
public static final class ServerPrefs extends ProtoMessage<ServerPrefs> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 server_prefs_id = 12;</code>
*/
private int serverPrefsId;
/**
* <code>optional bytes data = 5;</code>
*/
private final RepeatedByte data = RepeatedByte.newEmptyInstance();
private ServerPrefs() {
}
/**
* @return a new empty instance of {@code ServerPrefs}
*/
public static ServerPrefs newInstance() {
return new ServerPrefs();
}
/**
* <code>optional uint32 server_prefs_id = 12;</code>
* @return whether the serverPrefsId field is set
*/
public boolean hasServerPrefsId() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 server_prefs_id = 12;</code>
* @return this
*/
public ServerPrefs clearServerPrefsId() {
bitField0_ &= ~0x00000001;
serverPrefsId = 0;
return this;
}
/**
* <code>optional uint32 server_prefs_id = 12;</code>
* @return the serverPrefsId
*/
public int getServerPrefsId() {
return serverPrefsId;
}
/**
* <code>optional uint32 server_prefs_id = 12;</code>
* @param value the serverPrefsId to set
* @return this
*/
public ServerPrefs setServerPrefsId(final int value) {
bitField0_ |= 0x00000001;
serverPrefsId = value;
return this;
}
/**
* <code>optional bytes data = 5;</code>
* @return whether the data field is set
*/
public boolean hasData() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional bytes data = 5;</code>
* @return this
*/
public ServerPrefs clearData() {
bitField0_ &= ~0x00000002;
data.clear();
return this;
}
/**
* <code>optional bytes data = 5;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableData()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedByte getData() {
return data;
}
/**
* <code>optional bytes data = 5;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedByte getMutableData() {
bitField0_ |= 0x00000002;
return data;
}
/**
* <code>optional bytes data = 5;</code>
* @param value the data to add
* @return this
*/
public ServerPrefs addData(final byte value) {
bitField0_ |= 0x00000002;
data.add(value);
return this;
}
/**
* <code>optional bytes data = 5;</code>
* @param values the data to add
* @return this
*/
public ServerPrefs addAllData(final byte... values) {
bitField0_ |= 0x00000002;
data.addAll(values);
return this;
}
/**
* <code>optional bytes data = 5;</code>
* @param values the data to set
* @return this
*/
public ServerPrefs setData(final byte... values) {
bitField0_ |= 0x00000002;
data.copyFrom(values);
return this;
}
@Override
public ServerPrefs copyFrom(final ServerPrefs other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
serverPrefsId = other.serverPrefsId;
data.copyFrom(other.data);
}
return this;
}
@Override
public ServerPrefs mergeFrom(final ServerPrefs other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasServerPrefsId()) {
setServerPrefsId(other.serverPrefsId);
}
if (other.hasData()) {
getMutableData().copyFrom(other.data);
}
return this;
}
@Override
public ServerPrefs clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
serverPrefsId = 0;
data.clear();
return this;
}
@Override
public ServerPrefs clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
data.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ServerPrefs)) {
return false;
}
ServerPrefs other = (ServerPrefs) o;
return bitField0_ == other.bitField0_
&& (!hasServerPrefsId() || serverPrefsId == other.serverPrefsId)
&& (!hasData() || data.equals(other.data));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 96);
output.writeUInt32NoTag(serverPrefsId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 42);
output.writeBytesNoTag(data);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(serverPrefsId);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeBytesSizeNoTag(data);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public ServerPrefs mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 96: {
// serverPrefsId
serverPrefsId = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 42) {
break;
}
}
case 42: {
// data
input.readBytes(data);
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.serverPrefsId, serverPrefsId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeBytes(FieldNames.data, data);
}
output.endObject();
}
@Override
public ServerPrefs mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 656672552:
case 2077691526: {
if (input.isAtField(FieldNames.serverPrefsId)) {
if (!input.trySkipNullValue()) {
serverPrefsId = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 3076010: {
if (input.isAtField(FieldNames.data)) {
if (!input.trySkipNullValue()) {
input.readBytes(data);
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public ServerPrefs clone() {
return new ServerPrefs().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static ServerPrefs parseFrom(final byte[] data) throws InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new ServerPrefs(), data).checkInitialized();
}
public static ServerPrefs parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new ServerPrefs(), input).checkInitialized();
}
public static ServerPrefs parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new ServerPrefs(), input).checkInitialized();
}
/**
* @return factory for creating ServerPrefs messages
*/
public static MessageFactory<ServerPrefs> getFactory() {
return ServerPrefsFactory.INSTANCE;
}
private enum ServerPrefsFactory implements MessageFactory<ServerPrefs> {
INSTANCE;
@Override
public ServerPrefs create() {
return ServerPrefs.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName serverPrefsId = FieldName.forField("serverPrefsId", "server_prefs_id");
static final FieldName data = FieldName.forField("data");
}
}
}

View File

@ -0,0 +1,282 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;
import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
public final class UpdateServerPrefsDataCsReqOuterClass {
/**
* Protobuf type {@code UpdateServerPrefsDataCsReq}
*/
public static final class UpdateServerPrefsDataCsReq extends ProtoMessage<UpdateServerPrefsDataCsReq> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional .ServerPrefs server_prefs = 5;</code>
*/
private final ServerPrefsOuterClass.ServerPrefs serverPrefs = ServerPrefsOuterClass.ServerPrefs.newInstance();
private UpdateServerPrefsDataCsReq() {
}
/**
* @return a new empty instance of {@code UpdateServerPrefsDataCsReq}
*/
public static UpdateServerPrefsDataCsReq newInstance() {
return new UpdateServerPrefsDataCsReq();
}
/**
* <code>optional .ServerPrefs server_prefs = 5;</code>
* @return whether the serverPrefs field is set
*/
public boolean hasServerPrefs() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional .ServerPrefs server_prefs = 5;</code>
* @return this
*/
public UpdateServerPrefsDataCsReq clearServerPrefs() {
bitField0_ &= ~0x00000001;
serverPrefs.clear();
return this;
}
/**
* <code>optional .ServerPrefs server_prefs = 5;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableServerPrefs()} if you want to modify it.
*
* @return internal storage object for reading
*/
public ServerPrefsOuterClass.ServerPrefs getServerPrefs() {
return serverPrefs;
}
/**
* <code>optional .ServerPrefs server_prefs = 5;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public ServerPrefsOuterClass.ServerPrefs getMutableServerPrefs() {
bitField0_ |= 0x00000001;
return serverPrefs;
}
/**
* <code>optional .ServerPrefs server_prefs = 5;</code>
* @param value the serverPrefs to set
* @return this
*/
public UpdateServerPrefsDataCsReq setServerPrefs(
final ServerPrefsOuterClass.ServerPrefs value) {
bitField0_ |= 0x00000001;
serverPrefs.copyFrom(value);
return this;
}
@Override
public UpdateServerPrefsDataCsReq copyFrom(final UpdateServerPrefsDataCsReq other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
serverPrefs.copyFrom(other.serverPrefs);
}
return this;
}
@Override
public UpdateServerPrefsDataCsReq mergeFrom(final UpdateServerPrefsDataCsReq other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasServerPrefs()) {
getMutableServerPrefs().mergeFrom(other.serverPrefs);
}
return this;
}
@Override
public UpdateServerPrefsDataCsReq clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
serverPrefs.clear();
return this;
}
@Override
public UpdateServerPrefsDataCsReq clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
serverPrefs.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof UpdateServerPrefsDataCsReq)) {
return false;
}
UpdateServerPrefsDataCsReq other = (UpdateServerPrefsDataCsReq) o;
return bitField0_ == other.bitField0_
&& (!hasServerPrefs() || serverPrefs.equals(other.serverPrefs));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 42);
output.writeMessageNoTag(serverPrefs);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeMessageSizeNoTag(serverPrefs);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public UpdateServerPrefsDataCsReq mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 42: {
// serverPrefs
input.readMessage(serverPrefs);
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeMessage(FieldNames.serverPrefs, serverPrefs);
}
output.endObject();
}
@Override
public UpdateServerPrefsDataCsReq mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case -772500179:
case -2044692812: {
if (input.isAtField(FieldNames.serverPrefs)) {
if (!input.trySkipNullValue()) {
input.readMessage(serverPrefs);
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public UpdateServerPrefsDataCsReq clone() {
return new UpdateServerPrefsDataCsReq().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static UpdateServerPrefsDataCsReq parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new UpdateServerPrefsDataCsReq(), data).checkInitialized();
}
public static UpdateServerPrefsDataCsReq parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new UpdateServerPrefsDataCsReq(), input).checkInitialized();
}
public static UpdateServerPrefsDataCsReq parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new UpdateServerPrefsDataCsReq(), input).checkInitialized();
}
/**
* @return factory for creating UpdateServerPrefsDataCsReq messages
*/
public static MessageFactory<UpdateServerPrefsDataCsReq> getFactory() {
return UpdateServerPrefsDataCsReqFactory.INSTANCE;
}
private enum UpdateServerPrefsDataCsReqFactory implements MessageFactory<UpdateServerPrefsDataCsReq> {
INSTANCE;
@Override
public UpdateServerPrefsDataCsReq create() {
return UpdateServerPrefsDataCsReq.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName serverPrefs = FieldName.forField("serverPrefs", "server_prefs");
}
}
}

View File

@ -0,0 +1,340 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;
import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
public final class UpdateServerPrefsDataScRspOuterClass {
/**
* Protobuf type {@code UpdateServerPrefsDataScRsp}
*/
public static final class UpdateServerPrefsDataScRsp extends ProtoMessage<UpdateServerPrefsDataScRsp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 server_prefs_id = 2;</code>
*/
private int serverPrefsId;
/**
* <code>optional uint32 retcode = 12;</code>
*/
private int retcode;
private UpdateServerPrefsDataScRsp() {
}
/**
* @return a new empty instance of {@code UpdateServerPrefsDataScRsp}
*/
public static UpdateServerPrefsDataScRsp newInstance() {
return new UpdateServerPrefsDataScRsp();
}
/**
* <code>optional uint32 server_prefs_id = 2;</code>
* @return whether the serverPrefsId field is set
*/
public boolean hasServerPrefsId() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 server_prefs_id = 2;</code>
* @return this
*/
public UpdateServerPrefsDataScRsp clearServerPrefsId() {
bitField0_ &= ~0x00000001;
serverPrefsId = 0;
return this;
}
/**
* <code>optional uint32 server_prefs_id = 2;</code>
* @return the serverPrefsId
*/
public int getServerPrefsId() {
return serverPrefsId;
}
/**
* <code>optional uint32 server_prefs_id = 2;</code>
* @param value the serverPrefsId to set
* @return this
*/
public UpdateServerPrefsDataScRsp setServerPrefsId(final int value) {
bitField0_ |= 0x00000001;
serverPrefsId = value;
return this;
}
/**
* <code>optional uint32 retcode = 12;</code>
* @return whether the retcode field is set
*/
public boolean hasRetcode() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 retcode = 12;</code>
* @return this
*/
public UpdateServerPrefsDataScRsp clearRetcode() {
bitField0_ &= ~0x00000002;
retcode = 0;
return this;
}
/**
* <code>optional uint32 retcode = 12;</code>
* @return the retcode
*/
public int getRetcode() {
return retcode;
}
/**
* <code>optional uint32 retcode = 12;</code>
* @param value the retcode to set
* @return this
*/
public UpdateServerPrefsDataScRsp setRetcode(final int value) {
bitField0_ |= 0x00000002;
retcode = value;
return this;
}
@Override
public UpdateServerPrefsDataScRsp copyFrom(final UpdateServerPrefsDataScRsp other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
serverPrefsId = other.serverPrefsId;
retcode = other.retcode;
}
return this;
}
@Override
public UpdateServerPrefsDataScRsp mergeFrom(final UpdateServerPrefsDataScRsp other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasServerPrefsId()) {
setServerPrefsId(other.serverPrefsId);
}
if (other.hasRetcode()) {
setRetcode(other.retcode);
}
return this;
}
@Override
public UpdateServerPrefsDataScRsp clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
serverPrefsId = 0;
retcode = 0;
return this;
}
@Override
public UpdateServerPrefsDataScRsp clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof UpdateServerPrefsDataScRsp)) {
return false;
}
UpdateServerPrefsDataScRsp other = (UpdateServerPrefsDataScRsp) o;
return bitField0_ == other.bitField0_
&& (!hasServerPrefsId() || serverPrefsId == other.serverPrefsId)
&& (!hasRetcode() || retcode == other.retcode);
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 16);
output.writeUInt32NoTag(serverPrefsId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 96);
output.writeUInt32NoTag(retcode);
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(serverPrefsId);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public UpdateServerPrefsDataScRsp mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 16: {
// serverPrefsId
serverPrefsId = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 96) {
break;
}
}
case 96: {
// retcode
retcode = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.serverPrefsId, serverPrefsId);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.retcode, retcode);
}
output.endObject();
}
@Override
public UpdateServerPrefsDataScRsp mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 656672552:
case 2077691526: {
if (input.isAtField(FieldNames.serverPrefsId)) {
if (!input.trySkipNullValue()) {
serverPrefsId = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 1097936398: {
if (input.isAtField(FieldNames.retcode)) {
if (!input.trySkipNullValue()) {
retcode = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public UpdateServerPrefsDataScRsp clone() {
return new UpdateServerPrefsDataScRsp().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static UpdateServerPrefsDataScRsp parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new UpdateServerPrefsDataScRsp(), data).checkInitialized();
}
public static UpdateServerPrefsDataScRsp parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new UpdateServerPrefsDataScRsp(), input).checkInitialized();
}
public static UpdateServerPrefsDataScRsp parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new UpdateServerPrefsDataScRsp(), input).checkInitialized();
}
/**
* @return factory for creating UpdateServerPrefsDataScRsp messages
*/
public static MessageFactory<UpdateServerPrefsDataScRsp> getFactory() {
return UpdateServerPrefsDataScRspFactory.INSTANCE;
}
private enum UpdateServerPrefsDataScRspFactory implements MessageFactory<UpdateServerPrefsDataScRsp> {
INSTANCE;
@Override
public UpdateServerPrefsDataScRsp create() {
return UpdateServerPrefsDataScRsp.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName serverPrefsId = FieldName.forField("serverPrefsId", "server_prefs_id");
static final FieldName retcode = FieldName.forField("retcode");
}
}
}

View File

@ -0,0 +1,24 @@
package emu.lunarcore.server.packet.recv;
import emu.lunarcore.proto.UpdateServerPrefsDataCsReqOuterClass.UpdateServerPrefsDataCsReq;
import emu.lunarcore.server.game.GameSession;
import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.server.packet.Opcodes;
import emu.lunarcore.server.packet.PacketHandler;
import emu.lunarcore.server.packet.send.PacketUpdateServerPrefsDataScRsp;
@Opcodes(CmdId.UpdateServerPrefsDataCsReq)
public class HandlerUpdateServerPrefsDataCsReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] data) throws Exception {
var req = UpdateServerPrefsDataCsReq.parseFrom(data);
if (req.hasServerPrefs()) {
session.send(new PacketUpdateServerPrefsDataScRsp(req.getServerPrefs().getServerPrefsId()));
} else {
session.send(CmdId.UpdateServerPrefsDataScRsp);
}
}
}

View File

@ -0,0 +1,17 @@
package emu.lunarcore.server.packet.send;
import emu.lunarcore.proto.UpdateServerPrefsDataScRspOuterClass.UpdateServerPrefsDataScRsp;
import emu.lunarcore.server.packet.BasePacket;
import emu.lunarcore.server.packet.CmdId;
public class PacketUpdateServerPrefsDataScRsp extends BasePacket {
public PacketUpdateServerPrefsDataScRsp(int id) {
super(CmdId.UpdateServerPrefsDataScRsp);
var data = UpdateServerPrefsDataScRsp.newInstance()
.setServerPrefsId(id);
this.setData(data);
}
}