From f858db2a7d50cb9f0e76cefe7c7e393b7da3cfd5 Mon Sep 17 00:00:00 2001 From: Cervator Date: Sat, 28 Mar 2026 11:40:19 -0400 Subject: [PATCH 1/4] feat: add Nakama client for Bifrost cross-game chat Chunk 3 of the Bifrost First Contact plan. Adds Nakama Java SDK integration to DestinationSol with NakamaClient (connection, chat, message queue), NakamaConfig (dual-port: gRPC + WebSocket), /say console command, and game loop message polling. Incoming cross-game messages appear in the console. Uses Java 8 compatible APIs throughout. Co-Authored-By: Claude Opus 4.6 --- .../destination-sol-repositories.gradle | 1 + engine/build.gradle | 4 + .../org/destinationsol/SolApplication.java | 20 ++ .../game/chat/NakamaClient.java | 189 ++++++++++++++++++ .../game/chat/NakamaConfig.java | 46 +++++ .../game/chat/SayCommandHandler.java | 33 +++ .../game/chat/NakamaConfigTest.java | 18 ++ 7 files changed, 311 insertions(+) create mode 100644 engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java create mode 100644 engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java create mode 100644 engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java create mode 100644 engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java diff --git a/build-logic/src/main/groovy/destination-sol-repositories.gradle b/build-logic/src/main/groovy/destination-sol-repositories.gradle index 416ef11c5..55dbb3bc7 100644 --- a/build-logic/src/main/groovy/destination-sol-repositories.gradle +++ b/build-logic/src/main/groovy/destination-sol-repositories.gradle @@ -27,6 +27,7 @@ repositories { url "https://jitpack.io" content { includeModule('com.github.everit-org.json-schema', 'org.everit.json.schema') + includeModule('com.github.heroiclabs.nakama-java', 'nakama-java') } } diff --git a/engine/build.gradle b/engine/build.gradle index e54bf0991..d907c92b5 100644 --- a/engine/build.gradle +++ b/engine/build.gradle @@ -67,6 +67,10 @@ dependencies { api "org.terasology.nui:nui-reflect:$nuiVersion" implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.4.0' + implementation('com.github.heroiclabs.nakama-java:nakama-java:2.5.3') { + // DestSol uses protobuf 3.4.0 for EntityData — avoid conflict with newer protobuf + exclude group: 'com.google.protobuf' + } implementation "com.github.zafarkhaja:java-semver:0.10.0" // gestalt lost this... api "com.github.everit-org.json-schema:org.everit.json.schema:1.11.1" diff --git a/engine/src/main/java/org/destinationsol/SolApplication.java b/engine/src/main/java/org/destinationsol/SolApplication.java index 50b9f58e4..433a9782a 100644 --- a/engine/src/main/java/org/destinationsol/SolApplication.java +++ b/engine/src/main/java/org/destinationsol/SolApplication.java @@ -116,6 +116,7 @@ public class SolApplication implements ApplicationListener { private NUIManager nuiManager; private float timeAccumulator = 0; private boolean isMobile; + private org.destinationsol.game.chat.NakamaClient nakamaClient; private ComponentManager componentManager; private BeanContext appContext; private BeanContext gameContext; @@ -183,6 +184,14 @@ public void create() { menuScreens = new MenuScreens(layouts, isMobile(), options, nuiManager); nuiManager.pushScreen(menuScreens.main); + + // Nakama integration (optional, POC) + org.destinationsol.game.chat.NakamaConfig nakamaConfig = org.destinationsol.game.chat.NakamaConfig.fromSystemProperties(); + if (nakamaConfig.isEnabled()) { + nakamaClient = new org.destinationsol.game.chat.NakamaClient(nakamaConfig); + nakamaClient.connect(); + org.destinationsol.game.chat.SayCommandHandler.setNakamaClient(nakamaClient); + } } @Override @@ -267,6 +276,14 @@ private void update() { solGame.update(); } + // Poll Nakama for incoming cross-game chat messages + if (nakamaClient != null && nakamaClient.isConnected() && solGame != null) { + String msg; + while ((msg = nakamaClient.pollMessage()) != null) { + solGame.getScreens().consoleScreen.getConsole().addMessage(msg); + } + } + SolMath.checkVectorsTaken(null); } @@ -378,6 +395,9 @@ public MenuScreens getMenuScreens() { @Override public void dispose() { + if (nakamaClient != null) { + nakamaClient.disconnect(); + } commonDrawer.dispose(); if (solGame != null) { diff --git a/engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java b/engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java new file mode 100644 index 000000000..b8000d054 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java @@ -0,0 +1,189 @@ +// Copyright 2026 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.destinationsol.game.chat; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.heroiclabs.nakama.AbstractSocketListener; +import com.heroiclabs.nakama.Channel; +import com.heroiclabs.nakama.ChannelType; +import com.heroiclabs.nakama.Client; +import com.heroiclabs.nakama.DefaultClient; +import com.heroiclabs.nakama.Session; +import com.heroiclabs.nakama.SocketClient; +import com.heroiclabs.nakama.api.ChannelMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentLinkedQueue; + +/** + * Lightweight Nakama integration for DestinationSol. + * Connects to a shared chat channel for cross-game messaging. + * + * Enable via: -Dnakama.enabled=true -Dnakama.host=192.168.x.x -Dnakama.playerName=Bob + */ +public class NakamaClient { + private static final Logger logger = LoggerFactory.getLogger(NakamaClient.class); + private static final String GAME_ID = "destinationsol"; + private static final Map GAME_PREFIXES; + static { + Map m = new HashMap<>(); + m.put("terasology", "TS"); + m.put("destinationsol", "DS"); + m.put("minecraft", "MC"); + GAME_PREFIXES = Collections.unmodifiableMap(m); + } + + private final NakamaConfig config; + private Client client; + private Session session; + private SocketClient socket; + private Channel channel; + + // Thread-safe queue for incoming messages to be consumed on the game thread + private final ConcurrentLinkedQueue incomingMessages = new ConcurrentLinkedQueue<>(); + + public NakamaClient(NakamaConfig config) { + this.config = config; + } + + /** + * Connect to Nakama and join the chat channel. + * Call during game startup. + */ + public void connect() { + if (!config.isEnabled()) { + logger.info("Nakama client disabled"); + return; + } + try { + String deviceId = getOrCreateDeviceId(); + client = new DefaultClient("defaultkey", config.getHost(), config.getGrpcPort(), false); + session = client.authenticateDevice(deviceId).get(); + + if (!config.getPlayerName().isEmpty()) { + client.updateAccount(session, null, config.getPlayerName()).get(); + } + + logger.info("Nakama: authenticated as {}", session.getUserId()); + + socket = client.createSocket(config.getHost(), config.getWsPort(), false); + socket.connect(session, new AbstractSocketListener() { + @Override + public void onChannelMessage(ChannelMessage message) { + handleIncomingMessage(message); + } + }).get(); + + channel = socket.joinChat(config.getChannel(), ChannelType.ROOM).get(); + logger.info("Nakama: joined channel '{}'", config.getChannel()); + + } catch (Exception e) { + logger.warn("Nakama: connection failed, continuing without cross-game chat", e); + cleanup(); + } + } + + private void handleIncomingMessage(ChannelMessage message) { + try { + JsonObject content = JsonParser.parseString(message.getContent()).getAsJsonObject(); + String game = content.has("game") ? content.get("game").getAsString() : ""; + if (GAME_ID.equals(game)) { + return; // Echo filter + } + String player = content.has("player") ? content.get("player").getAsString() : "???"; + String text = content.has("text") ? content.get("text").getAsString() : ""; + String prefix = "[" + GAME_PREFIXES.getOrDefault(game, + game.toUpperCase().substring(0, Math.min(game.length(), 2))) + "]"; + String formatted = prefix + " " + player + ": " + text; + incomingMessages.add(formatted); + } catch (Exception e) { + logger.warn("Nakama: failed to parse incoming message", e); + } + } + + /** + * Send a chat message. Called from the /say console command. + */ + public boolean sendMessage(String text) { + if (socket == null || channel == null) { + return false; + } + try { + String playerName = config.getPlayerName().isEmpty() + ? session.getUserId().substring(0, 8) + : config.getPlayerName(); + + JsonObject content = new JsonObject(); + content.addProperty("game", GAME_ID); + content.addProperty("player", playerName); + content.addProperty("text", text); + socket.writeChatMessage(channel.getId(), content.toString()).get(); + return true; + } catch (Exception e) { + logger.warn("Nakama: failed to send message", e); + return false; + } + } + + /** + * Poll for incoming messages. Call from the game loop. + * Returns null if no messages are pending. + */ + public String pollMessage() { + return incomingMessages.poll(); + } + + public boolean isConnected() { + return socket != null && channel != null; + } + + public void disconnect() { + cleanup(); + } + + private void cleanup() { + if (socket != null) { + try { socket.disconnect(); } catch (Exception ignored) { } + socket = null; + } + channel = null; + session = null; + client = null; + } + + private String getOrCreateDeviceId() { + String id = System.getProperty("nakama.deviceId", ""); + if (!id.isEmpty()) { + return id; + } + Path idFile = Paths.get(System.getProperty("user.home"), ".bifrost", "device-id"); + try { + if (Files.exists(idFile)) { + id = new String(Files.readAllBytes(idFile), StandardCharsets.UTF_8).trim(); + if (!id.isEmpty()) { + return id; + } + } + id = UUID.randomUUID().toString(); + Files.createDirectories(idFile.getParent()); + Files.write(idFile, id.getBytes(StandardCharsets.UTF_8)); + logger.info("Nakama: created device ID {}", id); + } catch (IOException e) { + id = UUID.randomUUID().toString(); + logger.warn("Nakama: could not persist device ID, using ephemeral {}", id); + } + return id; + } +} diff --git a/engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java b/engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java new file mode 100644 index 000000000..9f09808a3 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java @@ -0,0 +1,46 @@ +// Copyright 2026 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.destinationsol.game.chat; + +/** + * Configuration for the Nakama client integration. + * Read from system properties for the POC. + */ +public class NakamaConfig { + private boolean enabled = false; + private String host = "localhost"; + private int grpcPort = 7349; + private int wsPort = 7350; + private String channel = "bifrost.lobby"; + private String playerName = ""; + + public boolean isEnabled() { return enabled; } + public void setEnabled(boolean enabled) { this.enabled = enabled; } + + public String getHost() { return host; } + public void setHost(String host) { this.host = host; } + + public int getGrpcPort() { return grpcPort; } + public void setGrpcPort(int grpcPort) { this.grpcPort = grpcPort; } + + public int getWsPort() { return wsPort; } + public void setWsPort(int wsPort) { this.wsPort = wsPort; } + + public String getChannel() { return channel; } + public void setChannel(String channel) { this.channel = channel; } + + public String getPlayerName() { return playerName; } + public void setPlayerName(String name) { this.playerName = name; } + + public static NakamaConfig fromSystemProperties() { + NakamaConfig config = new NakamaConfig(); + config.setEnabled(Boolean.parseBoolean(System.getProperty("nakama.enabled", "false"))); + config.setHost(System.getProperty("nakama.host", "localhost")); + config.setGrpcPort(Integer.parseInt(System.getProperty("nakama.grpcPort", "7349"))); + config.setWsPort(Integer.parseInt(System.getProperty("nakama.wsPort", "7350"))); + config.setChannel(System.getProperty("nakama.channel", "bifrost.lobby")); + config.setPlayerName(System.getProperty("nakama.playerName", "")); + return config; + } +} diff --git a/engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java b/engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java new file mode 100644 index 000000000..ce03f078f --- /dev/null +++ b/engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java @@ -0,0 +1,33 @@ +// Copyright 2026 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.destinationsol.game.chat; + +import org.destinationsol.game.console.annotations.Command; +import org.destinationsol.game.console.annotations.CommandParam; +import org.destinationsol.game.console.annotations.RegisterCommands; + +/** + * Console command for sending chat messages via Nakama. + * Usage: say "Hello from space!" + * + * Multi-word messages must be quoted: say "Read you loud and clear." + */ +@RegisterCommands +public class SayCommandHandler { + + private static NakamaClient nakamaClient; + + public static void setNakamaClient(NakamaClient client) { + nakamaClient = client; + } + + @Command(shortDescription = "Send a message to the Bifrost chat channel") + public String say(@CommandParam(value = "message") String message) { + if (nakamaClient == null || !nakamaClient.isConnected()) { + return "Nakama not connected. Enable with -Dnakama.enabled=true"; + } + boolean sent = nakamaClient.sendMessage(message); + return sent ? "Sent: " + message : "Failed to send message"; + } +} diff --git a/engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java b/engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java new file mode 100644 index 000000000..ced62ed52 --- /dev/null +++ b/engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java @@ -0,0 +1,18 @@ +// Copyright 2026 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.destinationsol.game.chat; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.*; + +class NakamaConfigTest { + @Test + void defaultsAreDisabled() { + NakamaConfig config = new NakamaConfig(); + assertFalse(config.isEnabled()); + assertEquals("bifrost.lobby", config.getChannel()); + assertEquals(7349, config.getGrpcPort()); + assertEquals(7350, config.getWsPort()); + } +} From 089d02e7f2544ad31a7b9ed34e272cef7ae9260e Mon Sep 17 00:00:00 2001 From: Cervator Date: Sat, 28 Mar 2026 23:48:46 -0400 Subject: [PATCH 2/4] feat: add nakama.ini config and upgrade protobuf to 4.28.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded Nakama config with nakama.ini file loaded via IniReader. Default ships as a resource, user edits the copy in the save directory. Upgrade protobuf from 3.4.0 to 4.28.2 to match Nakama SDK requirements — EntityData.java regenerated with protoc 28.2. Remove protobuf exclusion hack from nakama-java dependency. Co-Authored-By: Claude Opus 4.6 --- engine/build.gradle | 7 +- .../org/destinationsol/SolApplication.java | 4 +- .../game/chat/NakamaConfig.java | 39 +- .../destinationsol/protobuf/EntityData.java | 1433 +++++++++-------- engine/src/main/resources/nakama.ini | 8 + .../game/chat/NakamaConfigTest.java | 2 + 6 files changed, 781 insertions(+), 712 deletions(-) create mode 100644 engine/src/main/resources/nakama.ini diff --git a/engine/build.gradle b/engine/build.gradle index d907c92b5..f781d5fc0 100644 --- a/engine/build.gradle +++ b/engine/build.gradle @@ -66,11 +66,8 @@ dependencies { api "org.terasology.nui:nui-gestalt:$nuiVersion" api "org.terasology.nui:nui-reflect:$nuiVersion" - implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.4.0' - implementation('com.github.heroiclabs.nakama-java:nakama-java:2.5.3') { - // DestSol uses protobuf 3.4.0 for EntityData — avoid conflict with newer protobuf - exclude group: 'com.google.protobuf' - } + implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '4.28.2' + implementation 'com.github.heroiclabs.nakama-java:nakama-java:2.5.3' implementation "com.github.zafarkhaja:java-semver:0.10.0" // gestalt lost this... api "com.github.everit-org.json-schema:org.everit.json.schema:1.11.1" diff --git a/engine/src/main/java/org/destinationsol/SolApplication.java b/engine/src/main/java/org/destinationsol/SolApplication.java index 433a9782a..7f759694a 100644 --- a/engine/src/main/java/org/destinationsol/SolApplication.java +++ b/engine/src/main/java/org/destinationsol/SolApplication.java @@ -185,8 +185,8 @@ public void create() { nuiManager.pushScreen(menuScreens.main); - // Nakama integration (optional, POC) - org.destinationsol.game.chat.NakamaConfig nakamaConfig = org.destinationsol.game.chat.NakamaConfig.fromSystemProperties(); + // Nakama integration (optional, loaded from nakama.ini) + org.destinationsol.game.chat.NakamaConfig nakamaConfig = org.destinationsol.game.chat.NakamaConfig.load(); if (nakamaConfig.isEnabled()) { nakamaClient = new org.destinationsol.game.chat.NakamaClient(nakamaConfig); nakamaClient.connect(); diff --git a/engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java b/engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java index 9f09808a3..f67200535 100644 --- a/engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java +++ b/engine/src/main/java/org/destinationsol/game/chat/NakamaConfig.java @@ -3,11 +3,16 @@ package org.destinationsol.game.chat; +import org.destinationsol.IniReader; + /** * Configuration for the Nakama client integration. - * Read from system properties for the POC. + * Loaded from nakama.ini in the game's save directory. + * If the file doesn't exist, defaults are used (disabled). */ public class NakamaConfig { + private static final String CONFIG_FILE = "nakama.ini"; + private boolean enabled = false; private String host = "localhost"; private int grpcPort = 7349; @@ -33,14 +38,32 @@ public class NakamaConfig { public String getPlayerName() { return playerName; } public void setPlayerName(String name) { this.playerName = name; } - public static NakamaConfig fromSystemProperties() { + /** + * Load config from nakama.ini. Falls back to defaults if the file doesn't exist. + */ + public static NakamaConfig load() { NakamaConfig config = new NakamaConfig(); - config.setEnabled(Boolean.parseBoolean(System.getProperty("nakama.enabled", "false"))); - config.setHost(System.getProperty("nakama.host", "localhost")); - config.setGrpcPort(Integer.parseInt(System.getProperty("nakama.grpcPort", "7349"))); - config.setWsPort(Integer.parseInt(System.getProperty("nakama.wsPort", "7350"))); - config.setChannel(System.getProperty("nakama.channel", "bifrost.lobby")); - config.setPlayerName(System.getProperty("nakama.playerName", "")); + IniReader reader = new IniReader(CONFIG_FILE, null); + config.enabled = reader.getBoolean("enabled", false); + config.host = reader.getString("host", "localhost"); + config.grpcPort = reader.getInt("grpcPort", 7349); + config.wsPort = reader.getInt("wsPort", 7350); + config.channel = reader.getString("channel", "bifrost.lobby"); + config.playerName = reader.getString("playerName", ""); return config; } + + /** + * Save config to nakama.ini. + */ + public void save() { + IniReader.write(CONFIG_FILE, + "enabled", enabled, + "host", host, + "grpcPort", grpcPort, + "wsPort", wsPort, + "channel", channel, + "playerName", playerName + ); + } } diff --git a/engine/src/main/java/org/destinationsol/protobuf/EntityData.java b/engine/src/main/java/org/destinationsol/protobuf/EntityData.java index 81addd933..63221ee04 100644 --- a/engine/src/main/java/org/destinationsol/protobuf/EntityData.java +++ b/engine/src/main/java/org/destinationsol/protobuf/EntityData.java @@ -1,10 +1,21 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! -// source: protobuf/EntityData.proto +// NO CHECKED-IN PROTOBUF GENCODE +// source: EntityData.proto +// Protobuf Java Version: 4.28.2 package org.destinationsol.protobuf; public final class EntityData { private EntityData() {} + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 28, + /* patch= */ 2, + /* suffix= */ "", + EntityData.class.getName()); + } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } @@ -20,50 +31,68 @@ public interface FieldOrBuilder extends /** * optional string name = 1; + * @return Whether the name field is set. */ boolean hasName(); /** * optional string name = 1; + * @return The name. */ java.lang.String getName(); /** * optional string name = 1; + * @return The bytes for name. */ com.google.protobuf.ByteString getNameBytes(); /** * optional string type = 2; + * @return Whether the type field is set. */ boolean hasType(); /** * optional string type = 2; + * @return The type. */ java.lang.String getType(); /** * optional string type = 2; + * @return The bytes for type. */ com.google.protobuf.ByteString getTypeBytes(); /** * optional bytes value = 3; + * @return Whether the value field is set. */ boolean hasValue(); /** * optional bytes value = 3; + * @return The value. */ com.google.protobuf.ByteString getValue(); } /** * Protobuf type {@code Field} */ - public static final class Field extends - com.google.protobuf.GeneratedMessageV3 implements + public static final class Field extends + com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:Field) FieldOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 28, + /* patch= */ 2, + /* suffix= */ "", + Field.class.getName()); + } // Use Field.newBuilder() to construct. - private Field(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private Field(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private Field() { @@ -72,69 +101,13 @@ private Field() { value_ = com.google.protobuf.ByteString.EMPTY; } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Field( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - name_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - type_ = bs; - break; - } - case 26: { - bitField0_ |= 0x00000004; - value_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.destinationsol.protobuf.EntityData.internal_static_Field_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_Field_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -143,16 +116,21 @@ private Field( private int bitField0_; public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; /** * optional string name = 1; + * @return Whether the name field is set. */ + @java.lang.Override public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional string name = 1; + * @return The name. */ + @java.lang.Override public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { @@ -169,7 +147,9 @@ public java.lang.String getName() { } /** * optional string name = 1; + * @return The bytes for name. */ + @java.lang.Override public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; @@ -185,16 +165,21 @@ public java.lang.String getName() { } public static final int TYPE_FIELD_NUMBER = 2; - private volatile java.lang.Object type_; + @SuppressWarnings("serial") + private volatile java.lang.Object type_ = ""; /** * optional string type = 2; + * @return Whether the type field is set. */ + @java.lang.Override public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional string type = 2; + * @return The type. */ + @java.lang.Override public java.lang.String getType() { java.lang.Object ref = type_; if (ref instanceof java.lang.String) { @@ -211,7 +196,9 @@ public java.lang.String getType() { } /** * optional string type = 2; + * @return The bytes for type. */ + @java.lang.Override public com.google.protobuf.ByteString getTypeBytes() { java.lang.Object ref = type_; @@ -227,21 +214,26 @@ public java.lang.String getType() { } public static final int VALUE_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString value_; + private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY; /** * optional bytes value = 3; + * @return Whether the value field is set. */ + @java.lang.Override public boolean hasValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000004) != 0); } /** * optional bytes value = 3; + * @return The value. */ + @java.lang.Override public com.google.protobuf.ByteString getValue() { return value_; } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -251,41 +243,42 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, name_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, type_); + if (((bitField0_ & 0x00000002) != 0)) { + com.google.protobuf.GeneratedMessage.writeString(output, 2, type_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { output.writeBytes(3, value_); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, name_); } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, type_); + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(2, type_); } - if (((bitField0_ & 0x00000004) == 0x00000004)) { + if (((bitField0_ & 0x00000004) != 0)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, value_); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } - private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { @@ -296,24 +289,23 @@ public boolean equals(final java.lang.Object obj) { } org.destinationsol.protobuf.EntityData.Field other = (org.destinationsol.protobuf.EntityData.Field) obj; - boolean result = true; - result = result && (hasName() == other.hasName()); + if (hasName() != other.hasName()) return false; if (hasName()) { - result = result && getName() - .equals(other.getName()); + if (!getName() + .equals(other.getName())) return false; } - result = result && (hasType() == other.hasType()); + if (hasType() != other.hasType()) return false; if (hasType()) { - result = result && getType() - .equals(other.getType()); + if (!getType() + .equals(other.getType())) return false; } - result = result && (hasValue() == other.hasValue()); + if (hasValue() != other.hasValue()) return false; if (hasValue()) { - result = result && getValue() - .equals(other.getValue()); + if (!getValue() + .equals(other.getValue())) return false; } - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; } @java.lang.Override @@ -322,7 +314,7 @@ public int hashCode() { return memoizedHashCode; } int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (19 * hash) + getDescriptor().hashCode(); if (hasName()) { hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); @@ -335,11 +327,22 @@ public int hashCode() { hash = (37 * hash) + VALUE_FIELD_NUMBER; hash = (53 * hash) + getValue().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } + public static org.destinationsol.protobuf.EntityData.Field parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.destinationsol.protobuf.EntityData.Field parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.destinationsol.protobuf.EntityData.Field parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -363,42 +366,45 @@ public static org.destinationsol.protobuf.EntityData.Field parseFrom( } public static org.destinationsol.protobuf.EntityData.Field parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.Field parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + public static org.destinationsol.protobuf.EntityData.Field parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input); } + public static org.destinationsol.protobuf.EntityData.Field parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static org.destinationsol.protobuf.EntityData.Field parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.Field parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); @@ -406,6 +412,7 @@ public static Builder newBuilder() { public static Builder newBuilder(org.destinationsol.protobuf.EntityData.Field prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -413,7 +420,7 @@ public Builder toBuilder() { @java.lang.Override protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } @@ -421,7 +428,7 @@ protected Builder newBuilderForType( * Protobuf type {@code Field} */ public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements + com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:Field) org.destinationsol.protobuf.EntityData.FieldOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -429,7 +436,8 @@ public static final class Builder extends return org.destinationsol.protobuf.EntityData.internal_static_Field_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_Field_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -438,39 +446,36 @@ public static final class Builder extends // Construct using org.destinationsol.protobuf.EntityData.Field.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } + } + @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; name_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); type_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); value_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.destinationsol.protobuf.EntityData.internal_static_Field_descriptor; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Field getDefaultInstanceForType() { return org.destinationsol.protobuf.EntityData.Field.getDefaultInstance(); } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Field build() { org.destinationsol.protobuf.EntityData.Field result = buildPartial(); if (!result.isInitialized()) { @@ -479,53 +484,33 @@ public org.destinationsol.protobuf.EntityData.Field build() { return result; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Field buildPartial() { org.destinationsol.protobuf.EntityData.Field result = new org.destinationsol.protobuf.EntityData.Field(this); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartial0(org.destinationsol.protobuf.EntityData.Field result) { int from_bitField0_ = bitField0_; int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; to_bitField0_ |= 0x00000001; } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + if (((from_bitField0_ & 0x00000002) != 0)) { + result.type_ = type_; to_bitField0_ |= 0x00000002; } - result.type_ = type_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + if (((from_bitField0_ & 0x00000004) != 0)) { + result.value_ = value_; to_bitField0_ |= 0x00000004; } - result.value_ = value_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; + result.bitField0_ |= to_bitField0_; } - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.destinationsol.protobuf.EntityData.Field) { return mergeFrom((org.destinationsol.protobuf.EntityData.Field)other); @@ -538,42 +523,72 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(org.destinationsol.protobuf.EntityData.Field other) { if (other == org.destinationsol.protobuf.EntityData.Field.getDefaultInstance()) return this; if (other.hasName()) { - bitField0_ |= 0x00000001; name_ = other.name_; + bitField0_ |= 0x00000001; onChanged(); } if (other.hasType()) { - bitField0_ |= 0x00000002; type_ = other.type_; + bitField0_ |= 0x00000002; onChanged(); } if (other.hasValue()) { setValue(other.getValue()); } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.destinationsol.protobuf.EntityData.Field parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + name_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + type_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: { + value_ = input.readBytes(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.destinationsol.protobuf.EntityData.Field) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -581,12 +596,14 @@ public Builder mergeFrom( private java.lang.Object name_ = ""; /** * optional string name = 1; + * @return Whether the name field is set. */ public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional string name = 1; + * @return The name. */ public java.lang.String getName() { java.lang.Object ref = name_; @@ -604,6 +621,7 @@ public java.lang.String getName() { } /** * optional string name = 1; + * @return The bytes for name. */ public com.google.protobuf.ByteString getNameBytes() { @@ -620,36 +638,37 @@ public java.lang.String getName() { } /** * optional string name = 1; + * @param value The name to set. + * @return This builder for chaining. */ public Builder setName( java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } /** * optional string name = 1; + * @return This builder for chaining. */ public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } /** * optional string name = 1; + * @param value The bytes for name to set. + * @return This builder for chaining. */ public Builder setNameBytes( com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } name_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -657,12 +676,14 @@ public Builder setNameBytes( private java.lang.Object type_ = ""; /** * optional string type = 2; + * @return Whether the type field is set. */ public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); + return ((bitField0_ & 0x00000002) != 0); } /** * optional string type = 2; + * @return The type. */ public java.lang.String getType() { java.lang.Object ref = type_; @@ -680,6 +701,7 @@ public java.lang.String getType() { } /** * optional string type = 2; + * @return The bytes for type. */ public com.google.protobuf.ByteString getTypeBytes() { @@ -696,36 +718,37 @@ public java.lang.String getType() { } /** * optional string type = 2; + * @param value The type to set. + * @return This builder for chaining. */ public Builder setType( java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; + if (value == null) { throw new NullPointerException(); } type_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } /** * optional string type = 2; + * @return This builder for chaining. */ public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000002); type_ = getDefaultInstance().getType(); + bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } /** * optional string type = 2; + * @param value The bytes for type to set. + * @return This builder for chaining. */ public Builder setTypeBytes( com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; + if (value == null) { throw new NullPointerException(); } type_ = value; + bitField0_ |= 0x00000002; onChanged(); return this; } @@ -733,30 +756,35 @@ public Builder setTypeBytes( private com.google.protobuf.ByteString value_ = com.google.protobuf.ByteString.EMPTY; /** * optional bytes value = 3; + * @return Whether the value field is set. */ + @java.lang.Override public boolean hasValue() { - return ((bitField0_ & 0x00000004) == 0x00000004); + return ((bitField0_ & 0x00000004) != 0); } /** * optional bytes value = 3; + * @return The value. */ + @java.lang.Override public com.google.protobuf.ByteString getValue() { return value_; } /** * optional bytes value = 3; + * @param value The value to set. + * @return This builder for chaining. */ public Builder setValue(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; + if (value == null) { throw new NullPointerException(); } value_ = value; + bitField0_ |= 0x00000004; onChanged(); return this; } /** * optional bytes value = 3; + * @return This builder for chaining. */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000004); @@ -764,16 +792,6 @@ public Builder clearValue() { onChanged(); return this; } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:Field) } @@ -788,13 +806,25 @@ public static org.destinationsol.protobuf.EntityData.Field getDefaultInstance() return DEFAULT_INSTANCE; } - @java.lang.Deprecated public static final com.google.protobuf.Parser + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public Field parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Field(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -807,6 +837,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Field getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -819,14 +850,17 @@ public interface ComponentOrBuilder extends /** * optional string type_name = 1; + * @return Whether the typeName field is set. */ boolean hasTypeName(); /** * optional string type_name = 1; + * @return The typeName. */ java.lang.String getTypeName(); /** * optional string type_name = 1; + * @return The bytes for typeName. */ com.google.protobuf.ByteString getTypeNameBytes(); @@ -858,12 +892,22 @@ org.destinationsol.protobuf.EntityData.FieldOrBuilder getFieldOrBuilder( /** * Protobuf type {@code Component} */ - public static final class Component extends - com.google.protobuf.GeneratedMessageV3 implements + public static final class Component extends + com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:Component) ComponentOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 28, + /* patch= */ 2, + /* suffix= */ "", + Component.class.getName()); + } // Use Component.newBuilder() to construct. - private Component(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private Component(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private Component() { @@ -871,70 +915,13 @@ private Component() { field_ = java.util.Collections.emptyList(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Component( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - typeName_ = bs; - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - field_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - field_.add( - input.readMessage(org.destinationsol.protobuf.EntityData.Field.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - field_ = java.util.Collections.unmodifiableList(field_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.destinationsol.protobuf.EntityData.internal_static_Component_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_Component_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -943,16 +930,21 @@ private Component( private int bitField0_; public static final int TYPE_NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object typeName_; + @SuppressWarnings("serial") + private volatile java.lang.Object typeName_ = ""; /** * optional string type_name = 1; + * @return Whether the typeName field is set. */ + @java.lang.Override public boolean hasTypeName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional string type_name = 1; + * @return The typeName. */ + @java.lang.Override public java.lang.String getTypeName() { java.lang.Object ref = typeName_; if (ref instanceof java.lang.String) { @@ -969,7 +961,9 @@ public java.lang.String getTypeName() { } /** * optional string type_name = 1; + * @return The bytes for typeName. */ + @java.lang.Override public com.google.protobuf.ByteString getTypeNameBytes() { java.lang.Object ref = typeName_; @@ -985,16 +979,19 @@ public java.lang.String getTypeName() { } public static final int FIELD_FIELD_NUMBER = 2; + @SuppressWarnings("serial") private java.util.List field_; /** * repeated .Field field = 2; */ + @java.lang.Override public java.util.List getFieldList() { return field_; } /** * repeated .Field field = 2; */ + @java.lang.Override public java.util.List getFieldOrBuilderList() { return field_; @@ -1002,24 +999,28 @@ public java.util.List getFieldList /** * repeated .Field field = 2; */ + @java.lang.Override public int getFieldCount() { return field_.size(); } /** * repeated .Field field = 2; */ + @java.lang.Override public org.destinationsol.protobuf.EntityData.Field getField(int index) { return field_.get(index); } /** * repeated .Field field = 2; */ + @java.lang.Override public org.destinationsol.protobuf.EntityData.FieldOrBuilder getFieldOrBuilder( int index) { return field_.get(index); } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -1029,35 +1030,36 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, typeName_); + if (((bitField0_ & 0x00000001) != 0)) { + com.google.protobuf.GeneratedMessage.writeString(output, 1, typeName_); } for (int i = 0; i < field_.size(); i++) { output.writeMessage(2, field_.get(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, typeName_); + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.GeneratedMessage.computeStringSize(1, typeName_); } for (int i = 0; i < field_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, field_.get(i)); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } - private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { @@ -1068,16 +1070,15 @@ public boolean equals(final java.lang.Object obj) { } org.destinationsol.protobuf.EntityData.Component other = (org.destinationsol.protobuf.EntityData.Component) obj; - boolean result = true; - result = result && (hasTypeName() == other.hasTypeName()); + if (hasTypeName() != other.hasTypeName()) return false; if (hasTypeName()) { - result = result && getTypeName() - .equals(other.getTypeName()); + if (!getTypeName() + .equals(other.getTypeName())) return false; } - result = result && getFieldList() - .equals(other.getFieldList()); - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!getFieldList() + .equals(other.getFieldList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; } @java.lang.Override @@ -1086,7 +1087,7 @@ public int hashCode() { return memoizedHashCode; } int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (19 * hash) + getDescriptor().hashCode(); if (hasTypeName()) { hash = (37 * hash) + TYPE_NAME_FIELD_NUMBER; hash = (53 * hash) + getTypeName().hashCode(); @@ -1095,11 +1096,22 @@ public int hashCode() { hash = (37 * hash) + FIELD_FIELD_NUMBER; hash = (53 * hash) + getFieldList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } + public static org.destinationsol.protobuf.EntityData.Component parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.destinationsol.protobuf.EntityData.Component parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.destinationsol.protobuf.EntityData.Component parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -1123,42 +1135,45 @@ public static org.destinationsol.protobuf.EntityData.Component parseFrom( } public static org.destinationsol.protobuf.EntityData.Component parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.Component parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + public static org.destinationsol.protobuf.EntityData.Component parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input); } + public static org.destinationsol.protobuf.EntityData.Component parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static org.destinationsol.protobuf.EntityData.Component parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.Component parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); @@ -1166,6 +1181,7 @@ public static Builder newBuilder() { public static Builder newBuilder(org.destinationsol.protobuf.EntityData.Component prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -1173,7 +1189,7 @@ public Builder toBuilder() { @java.lang.Override protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } @@ -1181,7 +1197,7 @@ protected Builder newBuilderForType( * Protobuf type {@code Component} */ public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements + com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:Component) org.destinationsol.protobuf.EntityData.ComponentOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -1189,7 +1205,8 @@ public static final class Builder extends return org.destinationsol.protobuf.EntityData.internal_static_Component_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_Component_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -1198,42 +1215,41 @@ public static final class Builder extends // Construct using org.destinationsol.protobuf.EntityData.Component.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getFieldFieldBuilder(); - } + } + @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; typeName_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); if (fieldBuilder_ == null) { field_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); } else { + field_ = null; fieldBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000002); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.destinationsol.protobuf.EntityData.internal_static_Component_descriptor; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Component getDefaultInstanceForType() { return org.destinationsol.protobuf.EntityData.Component.getDefaultInstance(); } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Component build() { org.destinationsol.protobuf.EntityData.Component result = buildPartial(); if (!result.isInitialized()) { @@ -1242,16 +1258,18 @@ public org.destinationsol.protobuf.EntityData.Component build() { return result; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Component buildPartial() { org.destinationsol.protobuf.EntityData.Component result = new org.destinationsol.protobuf.EntityData.Component(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.typeName_ = typeName_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.destinationsol.protobuf.EntityData.Component result) { if (fieldBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { field_ = java.util.Collections.unmodifiableList(field_); bitField0_ = (bitField0_ & ~0x00000002); } @@ -1259,37 +1277,19 @@ public org.destinationsol.protobuf.EntityData.Component buildPartial() { } else { result.field_ = fieldBuilder_.build(); } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; } - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); + private void buildPartial0(org.destinationsol.protobuf.EntityData.Component result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.typeName_ = typeName_; + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } + + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.destinationsol.protobuf.EntityData.Component) { return mergeFrom((org.destinationsol.protobuf.EntityData.Component)other); @@ -1302,8 +1302,8 @@ public Builder mergeFrom(com.google.protobuf.Message other) { public Builder mergeFrom(org.destinationsol.protobuf.EntityData.Component other) { if (other == org.destinationsol.protobuf.EntityData.Component.getDefaultInstance()) return this; if (other.hasTypeName()) { - bitField0_ |= 0x00000001; typeName_ = other.typeName_; + bitField0_ |= 0x00000001; onChanged(); } if (fieldBuilder_ == null) { @@ -1325,37 +1325,70 @@ public Builder mergeFrom(org.destinationsol.protobuf.EntityData.Component other) field_ = other.field_; bitField0_ = (bitField0_ & ~0x00000002); fieldBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getFieldFieldBuilder() : null; } else { fieldBuilder_.addAllMessages(other.field_); } } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.destinationsol.protobuf.EntityData.Component parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + typeName_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: { + org.destinationsol.protobuf.EntityData.Field m = + input.readMessage( + org.destinationsol.protobuf.EntityData.Field.parser(), + extensionRegistry); + if (fieldBuilder_ == null) { + ensureFieldIsMutable(); + field_.add(m); + } else { + fieldBuilder_.addMessage(m); + } + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.destinationsol.protobuf.EntityData.Component) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -1363,12 +1396,14 @@ public Builder mergeFrom( private java.lang.Object typeName_ = ""; /** * optional string type_name = 1; + * @return Whether the typeName field is set. */ public boolean hasTypeName() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional string type_name = 1; + * @return The typeName. */ public java.lang.String getTypeName() { java.lang.Object ref = typeName_; @@ -1386,6 +1421,7 @@ public java.lang.String getTypeName() { } /** * optional string type_name = 1; + * @return The bytes for typeName. */ public com.google.protobuf.ByteString getTypeNameBytes() { @@ -1402,36 +1438,37 @@ public java.lang.String getTypeName() { } /** * optional string type_name = 1; + * @param value The typeName to set. + * @return This builder for chaining. */ public Builder setTypeName( java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } typeName_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } /** * optional string type_name = 1; + * @return This builder for chaining. */ public Builder clearTypeName() { - bitField0_ = (bitField0_ & ~0x00000001); typeName_ = getDefaultInstance().getTypeName(); + bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } /** * optional string type_name = 1; + * @param value The bytes for typeName to set. + * @return This builder for chaining. */ public Builder setTypeNameBytes( com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; + if (value == null) { throw new NullPointerException(); } typeName_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } @@ -1439,13 +1476,13 @@ public Builder setTypeNameBytes( private java.util.List field_ = java.util.Collections.emptyList(); private void ensureFieldIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { + if (!((bitField0_ & 0x00000002) != 0)) { field_ = new java.util.ArrayList(field_); bitField0_ |= 0x00000002; } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Field, org.destinationsol.protobuf.EntityData.Field.Builder, org.destinationsol.protobuf.EntityData.FieldOrBuilder> fieldBuilder_; /** @@ -1661,30 +1698,20 @@ public org.destinationsol.protobuf.EntityData.Field.Builder addFieldBuilder( getFieldBuilderList() { return getFieldFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Field, org.destinationsol.protobuf.EntityData.Field.Builder, org.destinationsol.protobuf.EntityData.FieldOrBuilder> getFieldFieldBuilder() { if (fieldBuilder_ == null) { - fieldBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + fieldBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Field, org.destinationsol.protobuf.EntityData.Field.Builder, org.destinationsol.protobuf.EntityData.FieldOrBuilder>( field_, - ((bitField0_ & 0x00000002) == 0x00000002), + ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); field_ = null; } return fieldBuilder_; } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:Component) } @@ -1699,13 +1726,25 @@ public static org.destinationsol.protobuf.EntityData.Component getDefaultInstanc return DEFAULT_INSTANCE; } - @java.lang.Deprecated public static final com.google.protobuf.Parser + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public Component parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Component(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -1718,6 +1757,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Component getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -1730,10 +1770,12 @@ public interface EntityOrBuilder extends /** * optional int32 id = 1; + * @return Whether the id field is set. */ boolean hasId(); /** * optional int32 id = 1; + * @return The id. */ int getId(); @@ -1764,82 +1806,35 @@ org.destinationsol.protobuf.EntityData.ComponentOrBuilder getComponentOrBuilder( /** * Protobuf type {@code Entity} */ - public static final class Entity extends - com.google.protobuf.GeneratedMessageV3 implements + public static final class Entity extends + com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:Entity) EntityOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 28, + /* patch= */ 2, + /* suffix= */ "", + Entity.class.getName()); + } // Use Entity.newBuilder() to construct. - private Entity(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private Entity(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private Entity() { - id_ = 0; component_ = java.util.Collections.emptyList(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private Entity( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - id_ = input.readInt32(); - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - component_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000002; - } - component_.add( - input.readMessage(org.destinationsol.protobuf.EntityData.Component.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - component_ = java.util.Collections.unmodifiableList(component_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.destinationsol.protobuf.EntityData.internal_static_Entity_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_Entity_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -1848,31 +1843,38 @@ private Entity( private int bitField0_; public static final int ID_FIELD_NUMBER = 1; - private int id_; + private int id_ = 0; /** * optional int32 id = 1; + * @return Whether the id field is set. */ + @java.lang.Override public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional int32 id = 1; + * @return The id. */ + @java.lang.Override public int getId() { return id_; } public static final int COMPONENT_FIELD_NUMBER = 2; + @SuppressWarnings("serial") private java.util.List component_; /** * repeated .Component component = 2; */ + @java.lang.Override public java.util.List getComponentList() { return component_; } /** * repeated .Component component = 2; */ + @java.lang.Override public java.util.List getComponentOrBuilderList() { return component_; @@ -1880,24 +1882,28 @@ public java.util.List getCompo /** * repeated .Component component = 2; */ + @java.lang.Override public int getComponentCount() { return component_.size(); } /** * repeated .Component component = 2; */ + @java.lang.Override public org.destinationsol.protobuf.EntityData.Component getComponent(int index) { return component_.get(index); } /** * repeated .Component component = 2; */ + @java.lang.Override public org.destinationsol.protobuf.EntityData.ComponentOrBuilder getComponentOrBuilder( int index) { return component_.get(index); } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -1907,23 +1913,25 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { output.writeInt32(1, id_); } for (int i = 0; i < component_.size(); i++) { output.writeMessage(2, component_.get(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, id_); } @@ -1931,12 +1939,11 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, component_.get(i)); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } - private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { @@ -1947,16 +1954,15 @@ public boolean equals(final java.lang.Object obj) { } org.destinationsol.protobuf.EntityData.Entity other = (org.destinationsol.protobuf.EntityData.Entity) obj; - boolean result = true; - result = result && (hasId() == other.hasId()); + if (hasId() != other.hasId()) return false; if (hasId()) { - result = result && (getId() - == other.getId()); + if (getId() + != other.getId()) return false; } - result = result && getComponentList() - .equals(other.getComponentList()); - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!getComponentList() + .equals(other.getComponentList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; } @java.lang.Override @@ -1965,7 +1971,7 @@ public int hashCode() { return memoizedHashCode; } int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (19 * hash) + getDescriptor().hashCode(); if (hasId()) { hash = (37 * hash) + ID_FIELD_NUMBER; hash = (53 * hash) + getId(); @@ -1974,11 +1980,22 @@ public int hashCode() { hash = (37 * hash) + COMPONENT_FIELD_NUMBER; hash = (53 * hash) + getComponentList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } + public static org.destinationsol.protobuf.EntityData.Entity parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.destinationsol.protobuf.EntityData.Entity parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.destinationsol.protobuf.EntityData.Entity parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -2002,42 +2019,45 @@ public static org.destinationsol.protobuf.EntityData.Entity parseFrom( } public static org.destinationsol.protobuf.EntityData.Entity parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.Entity parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + public static org.destinationsol.protobuf.EntityData.Entity parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input); } + public static org.destinationsol.protobuf.EntityData.Entity parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static org.destinationsol.protobuf.EntityData.Entity parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.Entity parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); @@ -2045,6 +2065,7 @@ public static Builder newBuilder() { public static Builder newBuilder(org.destinationsol.protobuf.EntityData.Entity prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -2052,7 +2073,7 @@ public Builder toBuilder() { @java.lang.Override protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } @@ -2060,7 +2081,7 @@ protected Builder newBuilderForType( * Protobuf type {@code Entity} */ public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements + com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:Entity) org.destinationsol.protobuf.EntityData.EntityOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -2068,7 +2089,8 @@ public static final class Builder extends return org.destinationsol.protobuf.EntityData.internal_static_Entity_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_Entity_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -2077,42 +2099,41 @@ public static final class Builder extends // Construct using org.destinationsol.protobuf.EntityData.Entity.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getComponentFieldBuilder(); - } + } + @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); if (componentBuilder_ == null) { component_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); } else { + component_ = null; componentBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000002); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.destinationsol.protobuf.EntityData.internal_static_Entity_descriptor; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Entity getDefaultInstanceForType() { return org.destinationsol.protobuf.EntityData.Entity.getDefaultInstance(); } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Entity build() { org.destinationsol.protobuf.EntityData.Entity result = buildPartial(); if (!result.isInitialized()) { @@ -2121,16 +2142,18 @@ public org.destinationsol.protobuf.EntityData.Entity build() { return result; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Entity buildPartial() { org.destinationsol.protobuf.EntityData.Entity result = new org.destinationsol.protobuf.EntityData.Entity(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.destinationsol.protobuf.EntityData.Entity result) { if (componentBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { + if (((bitField0_ & 0x00000002) != 0)) { component_ = java.util.Collections.unmodifiableList(component_); bitField0_ = (bitField0_ & ~0x00000002); } @@ -2138,37 +2161,19 @@ public org.destinationsol.protobuf.EntityData.Entity buildPartial() { } else { result.component_ = componentBuilder_.build(); } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; } - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); + private void buildPartial0(org.destinationsol.protobuf.EntityData.Entity result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.id_ = id_; + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; } + + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.destinationsol.protobuf.EntityData.Entity) { return mergeFrom((org.destinationsol.protobuf.EntityData.Entity)other); @@ -2202,37 +2207,70 @@ public Builder mergeFrom(org.destinationsol.protobuf.EntityData.Entity other) { component_ = other.component_; bitField0_ = (bitField0_ & ~0x00000002); componentBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getComponentFieldBuilder() : null; } else { componentBuilder_.addAllMessages(other.component_); } } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.destinationsol.protobuf.EntityData.Entity parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: { + id_ = input.readInt32(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: { + org.destinationsol.protobuf.EntityData.Component m = + input.readMessage( + org.destinationsol.protobuf.EntityData.Component.parser(), + extensionRegistry); + if (componentBuilder_ == null) { + ensureComponentIsMutable(); + component_.add(m); + } else { + componentBuilder_.addMessage(m); + } + break; + } // case 18 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.destinationsol.protobuf.EntityData.Entity) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -2240,27 +2278,35 @@ public Builder mergeFrom( private int id_ ; /** * optional int32 id = 1; + * @return Whether the id field is set. */ + @java.lang.Override public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); + return ((bitField0_ & 0x00000001) != 0); } /** * optional int32 id = 1; + * @return The id. */ + @java.lang.Override public int getId() { return id_; } /** * optional int32 id = 1; + * @param value The id to set. + * @return This builder for chaining. */ public Builder setId(int value) { - bitField0_ |= 0x00000001; + id_ = value; + bitField0_ |= 0x00000001; onChanged(); return this; } /** * optional int32 id = 1; + * @return This builder for chaining. */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); @@ -2272,13 +2318,13 @@ public Builder clearId() { private java.util.List component_ = java.util.Collections.emptyList(); private void ensureComponentIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { + if (!((bitField0_ & 0x00000002) != 0)) { component_ = new java.util.ArrayList(component_); bitField0_ |= 0x00000002; } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Component, org.destinationsol.protobuf.EntityData.Component.Builder, org.destinationsol.protobuf.EntityData.ComponentOrBuilder> componentBuilder_; /** @@ -2494,30 +2540,20 @@ public org.destinationsol.protobuf.EntityData.Component.Builder addComponentBuil getComponentBuilderList() { return getComponentFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Component, org.destinationsol.protobuf.EntityData.Component.Builder, org.destinationsol.protobuf.EntityData.ComponentOrBuilder> getComponentFieldBuilder() { if (componentBuilder_ == null) { - componentBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + componentBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Component, org.destinationsol.protobuf.EntityData.Component.Builder, org.destinationsol.protobuf.EntityData.ComponentOrBuilder>( component_, - ((bitField0_ & 0x00000002) == 0x00000002), + ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); component_ = null; } return componentBuilder_; } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:Entity) } @@ -2532,13 +2568,25 @@ public static org.destinationsol.protobuf.EntityData.Entity getDefaultInstance() return DEFAULT_INSTANCE; } - @java.lang.Deprecated public static final com.google.protobuf.Parser + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public Entity parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new Entity(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -2551,6 +2599,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.Entity getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -2588,76 +2637,35 @@ org.destinationsol.protobuf.EntityData.EntityOrBuilder getEntityOrBuilder( /** * Protobuf type {@code EntityStore} */ - public static final class EntityStore extends - com.google.protobuf.GeneratedMessageV3 implements + public static final class EntityStore extends + com.google.protobuf.GeneratedMessage implements // @@protoc_insertion_point(message_implements:EntityStore) EntityStoreOrBuilder { + private static final long serialVersionUID = 0L; + static { + com.google.protobuf.RuntimeVersion.validateProtobufGencodeVersion( + com.google.protobuf.RuntimeVersion.RuntimeDomain.PUBLIC, + /* major= */ 4, + /* minor= */ 28, + /* patch= */ 2, + /* suffix= */ "", + EntityStore.class.getName()); + } // Use EntityStore.newBuilder() to construct. - private EntityStore(com.google.protobuf.GeneratedMessageV3.Builder builder) { + private EntityStore(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); } private EntityStore() { entity_ = java.util.Collections.emptyList(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private EntityStore( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - entity_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000001; - } - entity_.add( - input.readMessage(org.destinationsol.protobuf.EntityData.Entity.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - entity_ = java.util.Collections.unmodifiableList(entity_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.destinationsol.protobuf.EntityData.internal_static_EntityStore_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_EntityStore_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -2665,16 +2673,19 @@ private EntityStore( } public static final int ENTITY_FIELD_NUMBER = 1; + @SuppressWarnings("serial") private java.util.List entity_; /** * repeated .Entity entity = 1; */ + @java.lang.Override public java.util.List getEntityList() { return entity_; } /** * repeated .Entity entity = 1; */ + @java.lang.Override public java.util.List getEntityOrBuilderList() { return entity_; @@ -2682,24 +2693,28 @@ public java.util.List getEntityLi /** * repeated .Entity entity = 1; */ + @java.lang.Override public int getEntityCount() { return entity_.size(); } /** * repeated .Entity entity = 1; */ + @java.lang.Override public org.destinationsol.protobuf.EntityData.Entity getEntity(int index) { return entity_.get(index); } /** * repeated .Entity entity = 1; */ + @java.lang.Override public org.destinationsol.protobuf.EntityData.EntityOrBuilder getEntityOrBuilder( int index) { return entity_.get(index); } private byte memoizedIsInitialized = -1; + @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; @@ -2709,14 +2724,16 @@ public final boolean isInitialized() { return true; } + @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { for (int i = 0; i < entity_.size(); i++) { output.writeMessage(1, entity_.get(i)); } - unknownFields.writeTo(output); + getUnknownFields().writeTo(output); } + @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; @@ -2726,12 +2743,11 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, entity_.get(i)); } - size += unknownFields.getSerializedSize(); + size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; } - private static final long serialVersionUID = 0L; @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { @@ -2742,11 +2758,10 @@ public boolean equals(final java.lang.Object obj) { } org.destinationsol.protobuf.EntityData.EntityStore other = (org.destinationsol.protobuf.EntityData.EntityStore) obj; - boolean result = true; - result = result && getEntityList() - .equals(other.getEntityList()); - result = result && unknownFields.equals(other.unknownFields); - return result; + if (!getEntityList() + .equals(other.getEntityList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; } @java.lang.Override @@ -2755,16 +2770,27 @@ public int hashCode() { return memoizedHashCode; } int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); + hash = (19 * hash) + getDescriptor().hashCode(); if (getEntityCount() > 0) { hash = (37 * hash) + ENTITY_FIELD_NUMBER; hash = (53 * hash) + getEntityList().hashCode(); } - hash = (29 * hash) + unknownFields.hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; } + public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { @@ -2788,42 +2814,45 @@ public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom( } public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + public static org.destinationsol.protobuf.EntityData.EntityStore parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input); } + public static org.destinationsol.protobuf.EntityData.EntityStore parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input); } public static org.destinationsol.protobuf.EntityData.EntityStore parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 + return com.google.protobuf.GeneratedMessage .parseWithIOException(PARSER, input, extensionRegistry); } + @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); @@ -2831,6 +2860,7 @@ public static Builder newBuilder() { public static Builder newBuilder(org.destinationsol.protobuf.EntityData.EntityStore prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } + @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); @@ -2838,7 +2868,7 @@ public Builder toBuilder() { @java.lang.Override protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } @@ -2846,7 +2876,7 @@ protected Builder newBuilderForType( * Protobuf type {@code EntityStore} */ public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder implements + com.google.protobuf.GeneratedMessage.Builder implements // @@protoc_insertion_point(builder_implements:EntityStore) org.destinationsol.protobuf.EntityData.EntityStoreOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor @@ -2854,7 +2884,8 @@ public static final class Builder extends return org.destinationsol.protobuf.EntityData.internal_static_EntityStore_descriptor; } - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + @java.lang.Override + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return org.destinationsol.protobuf.EntityData.internal_static_EntityStore_fieldAccessorTable .ensureFieldAccessorsInitialized( @@ -2863,40 +2894,40 @@ public static final class Builder extends // Construct using org.destinationsol.protobuf.EntityData.EntityStore.newBuilder() private Builder() { - maybeForceBuilderInitialization(); + } private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getEntityFieldBuilder(); - } + } + @java.lang.Override public Builder clear() { super.clear(); + bitField0_ = 0; if (entityBuilder_ == null) { entity_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); } else { + entity_ = null; entityBuilder_.clear(); } + bitField0_ = (bitField0_ & ~0x00000001); return this; } + @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return org.destinationsol.protobuf.EntityData.internal_static_EntityStore_descriptor; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.EntityStore getDefaultInstanceForType() { return org.destinationsol.protobuf.EntityData.EntityStore.getDefaultInstance(); } + @java.lang.Override public org.destinationsol.protobuf.EntityData.EntityStore build() { org.destinationsol.protobuf.EntityData.EntityStore result = buildPartial(); if (!result.isInitialized()) { @@ -2905,11 +2936,18 @@ public org.destinationsol.protobuf.EntityData.EntityStore build() { return result; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.EntityStore buildPartial() { org.destinationsol.protobuf.EntityData.EntityStore result = new org.destinationsol.protobuf.EntityData.EntityStore(this); - int from_bitField0_ = bitField0_; + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { buildPartial0(result); } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields(org.destinationsol.protobuf.EntityData.EntityStore result) { if (entityBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001)) { + if (((bitField0_ & 0x00000001) != 0)) { entity_ = java.util.Collections.unmodifiableList(entity_); bitField0_ = (bitField0_ & ~0x00000001); } @@ -2917,36 +2955,13 @@ public org.destinationsol.protobuf.EntityData.EntityStore buildPartial() { } else { result.entity_ = entityBuilder_.build(); } - onBuilt(); - return result; } - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); + private void buildPartial0(org.destinationsol.protobuf.EntityData.EntityStore result) { + int from_bitField0_ = bitField0_; } + + @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof org.destinationsol.protobuf.EntityData.EntityStore) { return mergeFrom((org.destinationsol.protobuf.EntityData.EntityStore)other); @@ -2977,37 +2992,65 @@ public Builder mergeFrom(org.destinationsol.protobuf.EntityData.EntityStore othe entity_ = other.entity_; bitField0_ = (bitField0_ & ~0x00000001); entityBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEntityFieldBuilder() : null; } else { entityBuilder_.addAllMessages(other.entity_); } } } - this.mergeUnknownFields(other.unknownFields); + this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; } + @java.lang.Override public final boolean isInitialized() { return true; } + @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.destinationsol.protobuf.EntityData.EntityStore parsedMessage = null; + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: { + org.destinationsol.protobuf.EntityData.Entity m = + input.readMessage( + org.destinationsol.protobuf.EntityData.Entity.parser(), + extensionRegistry); + if (entityBuilder_ == null) { + ensureEntityIsMutable(); + entity_.add(m); + } else { + entityBuilder_.addMessage(m); + } + break; + } // case 10 + default: { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.destinationsol.protobuf.EntityData.EntityStore) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } + onChanged(); + } // finally return this; } private int bitField0_; @@ -3015,13 +3058,13 @@ public Builder mergeFrom( private java.util.List entity_ = java.util.Collections.emptyList(); private void ensureEntityIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { + if (!((bitField0_ & 0x00000001) != 0)) { entity_ = new java.util.ArrayList(entity_); bitField0_ |= 0x00000001; } } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Entity, org.destinationsol.protobuf.EntityData.Entity.Builder, org.destinationsol.protobuf.EntityData.EntityOrBuilder> entityBuilder_; /** @@ -3237,30 +3280,20 @@ public org.destinationsol.protobuf.EntityData.Entity.Builder addEntityBuilder( getEntityBuilderList() { return getEntityFieldBuilder().getBuilderList(); } - private com.google.protobuf.RepeatedFieldBuilderV3< + private com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Entity, org.destinationsol.protobuf.EntityData.Entity.Builder, org.destinationsol.protobuf.EntityData.EntityOrBuilder> getEntityFieldBuilder() { if (entityBuilder_ == null) { - entityBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + entityBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< org.destinationsol.protobuf.EntityData.Entity, org.destinationsol.protobuf.EntityData.Entity.Builder, org.destinationsol.protobuf.EntityData.EntityOrBuilder>( entity_, - ((bitField0_ & 0x00000001) == 0x00000001), + ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); entity_ = null; } return entityBuilder_; } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - // @@protoc_insertion_point(builder_scope:EntityStore) } @@ -3275,13 +3308,25 @@ public static org.destinationsol.protobuf.EntityData.EntityStore getDefaultInsta return DEFAULT_INSTANCE; } - @java.lang.Deprecated public static final com.google.protobuf.Parser + private static final com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override public EntityStore parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new EntityStore(input, extensionRegistry); + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); } }; @@ -3294,6 +3339,7 @@ public com.google.protobuf.Parser getParserForType() { return PARSER; } + @java.lang.Override public org.destinationsol.protobuf.EntityData.EntityStore getDefaultInstanceForType() { return DEFAULT_INSTANCE; } @@ -3303,22 +3349,22 @@ public org.destinationsol.protobuf.EntityData.EntityStore getDefaultInstanceForT private static final com.google.protobuf.Descriptors.Descriptor internal_static_Field_descriptor; private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Field_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_Component_descriptor; private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Component_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_Entity_descriptor; private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Entity_fieldAccessorTable; private static final com.google.protobuf.Descriptors.Descriptor internal_static_EntityStore_descriptor; private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_EntityStore_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor @@ -3329,50 +3375,43 @@ public org.destinationsol.protobuf.EntityData.EntityStore getDefaultInstanceForT descriptor; static { java.lang.String[] descriptorData = { - "\n\031protobuf/EntityData.proto\"2\n\005Field\022\014\n\004" + - "name\030\001 \001(\t\022\014\n\004type\030\002 \001(\t\022\r\n\005value\030\003 \001(\014\"" + - "5\n\tComponent\022\021\n\ttype_name\030\001 \001(\t\022\025\n\005field" + - "\030\002 \003(\0132\006.Field\"3\n\006Entity\022\n\n\002id\030\001 \001(\005\022\035\n\t" + - "component\030\002 \003(\0132\n.Component\"&\n\013EntitySto" + - "re\022\027\n\006entity\030\001 \003(\0132\007.EntityB+\n\033org.desti" + - "nationsol.protobufB\nEntityDataH\001" + "\n\020EntityData.proto\"2\n\005Field\022\014\n\004name\030\001 \001(" + + "\t\022\014\n\004type\030\002 \001(\t\022\r\n\005value\030\003 \001(\014\"5\n\tCompon" + + "ent\022\021\n\ttype_name\030\001 \001(\t\022\025\n\005field\030\002 \003(\0132\006." + + "Field\"3\n\006Entity\022\n\n\002id\030\001 \001(\005\022\035\n\tcomponent" + + "\030\002 \003(\0132\n.Component\"&\n\013EntityStore\022\027\n\006ent" + + "ity\030\001 \003(\0132\007.EntityB+\n\033org.destinationsol" + + ".protobufB\nEntityDataH\001" }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor + descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); + }); internal_static_Field_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_Field_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Field_descriptor, new java.lang.String[] { "Name", "Type", "Value", }); internal_static_Component_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_Component_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Component_descriptor, new java.lang.String[] { "TypeName", "Field", }); internal_static_Entity_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_Entity_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Entity_descriptor, new java.lang.String[] { "Id", "Component", }); internal_static_EntityStore_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_EntityStore_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_EntityStore_descriptor, new java.lang.String[] { "Entity", }); + descriptor.resolveAllFeaturesImmutable(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/engine/src/main/resources/nakama.ini b/engine/src/main/resources/nakama.ini new file mode 100644 index 000000000..7a3ec644b --- /dev/null +++ b/engine/src/main/resources/nakama.ini @@ -0,0 +1,8 @@ +# Nakama / Bifrost cross-game chat configuration +# Set enabled=true and configure host/ports to connect to a Nakama server +enabled=false +host=localhost +grpcPort=7349 +wsPort=7350 +channel=bifrost.lobby +playerName= diff --git a/engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java b/engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java index ced62ed52..77e981770 100644 --- a/engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java +++ b/engine/src/test/java/org/destinationsol/game/chat/NakamaConfigTest.java @@ -14,5 +14,7 @@ void defaultsAreDisabled() { assertEquals("bifrost.lobby", config.getChannel()); assertEquals(7349, config.getGrpcPort()); assertEquals(7350, config.getWsPort()); + assertEquals("localhost", config.getHost()); + assertEquals("", config.getPlayerName()); } } From 4f9d11f061dc6b675835317bc9a952e4ab4742b5 Mon Sep 17 00:00:00 2001 From: Cervator Date: Sun, 29 Mar 2026 00:56:08 -0400 Subject: [PATCH 3/4] feat: show Nakama messages as HUD banner in gameplay Incoming cross-game chat messages now display as a fading banner on the game HUD with a semi-transparent dark background for readability. The banner fades over 5 seconds. Messages also still go to the console log. Follows the ZoneNameAnnouncer pattern from the existing codebase. Co-Authored-By: Claude Opus 4.6 --- .../org/destinationsol/SolApplication.java | 5 ++ .../game/chat/NakamaAnnouncer.java | 64 +++++++++++++++++++ .../ui/nui/screens/MainGameScreen.java | 8 +++ 3 files changed, 77 insertions(+) create mode 100644 engine/src/main/java/org/destinationsol/game/chat/NakamaAnnouncer.java diff --git a/engine/src/main/java/org/destinationsol/SolApplication.java b/engine/src/main/java/org/destinationsol/SolApplication.java index 7f759694a..0ee77fe93 100644 --- a/engine/src/main/java/org/destinationsol/SolApplication.java +++ b/engine/src/main/java/org/destinationsol/SolApplication.java @@ -281,6 +281,11 @@ private void update() { String msg; while ((msg = nakamaClient.pollMessage()) != null) { solGame.getScreens().consoleScreen.getConsole().addMessage(msg); + org.destinationsol.game.chat.NakamaAnnouncer announcer = + solGame.getScreens().mainGameScreen.getNakamaAnnouncer(); + if (announcer != null) { + announcer.announce(msg); + } } } diff --git a/engine/src/main/java/org/destinationsol/game/chat/NakamaAnnouncer.java b/engine/src/main/java/org/destinationsol/game/chat/NakamaAnnouncer.java new file mode 100644 index 000000000..1c8cf0a25 --- /dev/null +++ b/engine/src/main/java/org/destinationsol/game/chat/NakamaAnnouncer.java @@ -0,0 +1,64 @@ +// Copyright 2026 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +package org.destinationsol.game.chat; + +import com.badlogic.gdx.graphics.Color; +import com.badlogic.gdx.math.Rectangle; +import org.destinationsol.Const; +import org.destinationsol.SolApplication; +import org.destinationsol.ui.DisplayDimensions; +import org.destinationsol.ui.FontSize; +import org.destinationsol.ui.UiDrawer; + +/** + * Displays incoming Nakama cross-game chat messages as a fading banner + * on the game HUD, similar to zone name announcements. + */ +public class NakamaAnnouncer { + private static final float FADE_TIME = 5f; + private static final float DISPLAY_Y = 0.06f; + private static final float BG_PADDING_X = 0.08f; + private static final float BG_PADDING_Y = 0.008f; + private static final float BG_HEIGHT = 0.03f; + + private final DisplayDimensions displayDimensions; + private final Color textColor = new Color(0.6f, 0.9f, 1f, 0f); + private final Color bgColor = new Color(0f, 0f, 0f, 0f); + private String text = ""; + + public NakamaAnnouncer() { + displayDimensions = SolApplication.displayDimensions; + } + + /** + * Show a new message. Resets the fade timer. + */ + public void announce(String message) { + text = message; + textColor.a = 1f; + bgColor.a = 0.8f; + } + + public void update() { + if (textColor.a > 0) { + textColor.a -= Const.REAL_TIME_STEP / FADE_TIME; + bgColor.a = Math.min(0.8f, textColor.a) * 0.8f; + } + } + + public void drawText(UiDrawer uiDrawer) { + if (textColor.a <= 0) { + return; + } + float centerX = displayDimensions.getRatio() / 2; + Rectangle bg = new Rectangle( + centerX - BG_PADDING_X - displayDimensions.getRatio() * 0.15f, + DISPLAY_Y - BG_PADDING_Y, + displayDimensions.getRatio() * 0.3f + BG_PADDING_X * 2, + BG_HEIGHT + BG_PADDING_Y * 2 + ); + uiDrawer.draw(bg, bgColor); + uiDrawer.drawString(text, centerX, DISPLAY_Y + BG_HEIGHT / 2, FontSize.MENU, true, textColor); + } +} diff --git a/engine/src/main/java/org/destinationsol/ui/nui/screens/MainGameScreen.java b/engine/src/main/java/org/destinationsol/ui/nui/screens/MainGameScreen.java index 4eb135913..54c291687 100644 --- a/engine/src/main/java/org/destinationsol/ui/nui/screens/MainGameScreen.java +++ b/engine/src/main/java/org/destinationsol/ui/nui/screens/MainGameScreen.java @@ -112,6 +112,7 @@ public class MainGameScreen extends NUIScreenLayer { private FlowLayout warnDrawers; private BorderDrawer borderDrawer; private ZoneNameAnnouncer zoneNameAnnouncer; + private org.destinationsol.game.chat.NakamaAnnouncer nakamaAnnouncer; private com.badlogic.gdx.graphics.Color compassTint; private final SolApplication solApplication; @@ -435,6 +436,7 @@ public Boolean get() { borderDrawer = new BorderDrawer(); zoneNameAnnouncer = new ZoneNameAnnouncer(); + nakamaAnnouncer = new org.destinationsol.game.chat.NakamaAnnouncer(); } @Override @@ -551,6 +553,7 @@ public void update(float delta) { } zoneNameAnnouncer.update(solApplication.getGame(), solApplication.getGame().getContext()); + nakamaAnnouncer.update(); } @Override @@ -562,6 +565,7 @@ public void onDraw(Canvas canvas) { try (NUIManager.LegacyUiDrawerWrapper wrapper = nuiManager.getLegacyUiDrawer()) { borderDrawer.draw(wrapper.getUiDrawer(), solApplication, solApplication.getGame().getContext()); zoneNameAnnouncer.drawText(wrapper.getUiDrawer()); + nakamaAnnouncer.drawText(wrapper.getUiDrawer()); drawHeightCompass(wrapper); } } @@ -669,6 +673,10 @@ public UIWarnButton getMercsButton() { return mercsButton; } + public org.destinationsol.game.chat.NakamaAnnouncer getNakamaAnnouncer() { + return nakamaAnnouncer; + } + /** * Creates and adds a new warn drawer with the specified properties and activation condition. * @param id the id used for the drawer widget From a89e4e14b7f4076b84f912a1e96cfff8b8e0fc9a Mon Sep 17 00:00:00 2001 From: Cervator Date: Wed, 1 Apr 2026 14:50:57 -0400 Subject: [PATCH 4/4] A few more tweaks --- .../game/chat/NakamaClient.java | 58 +++++++++++++++++ .../game/chat/SayCommandHandler.java | 63 +++++++++++++++++-- .../game/screens/ShowInventory.java | 42 ++++++++++++- engine/src/main/resources/nakama.ini | 8 +-- gradle.properties | 6 ++ 5 files changed, 167 insertions(+), 10 deletions(-) diff --git a/engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java b/engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java index b8000d054..8d2312275 100644 --- a/engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java +++ b/engine/src/main/java/org/destinationsol/game/chat/NakamaClient.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicReference; /** * Lightweight Nakama integration for DestinationSol. @@ -54,6 +55,9 @@ public class NakamaClient { // Thread-safe queue for incoming messages to be consumed on the game thread private final ConcurrentLinkedQueue incomingMessages = new ConcurrentLinkedQueue<>(); + // Last received item link — consumed by Beam In + private final AtomicReference lastItemLink = new AtomicReference<>(); + public NakamaClient(NakamaConfig config) { this.config = config; } @@ -106,6 +110,17 @@ private void handleIncomingMessage(ChannelMessage message) { String text = content.has("text") ? content.get("text").getAsString() : ""; String prefix = "[" + GAME_PREFIXES.getOrDefault(game, game.toUpperCase().substring(0, Math.min(game.length(), 2))) + "]"; + + // Check for item link message + String type = content.has("type") ? content.get("type").getAsString() : "chat"; + if ("item_link".equals(type)) { + lastItemLink.set(content); + String itemName = content.has("name") ? content.get("name").getAsString() : "???"; + String formatted = prefix + " " + player + " beamed: [" + itemName + "]"; + incomingMessages.add(formatted); + return; + } + String formatted = prefix + " " + player + ": " + text; incomingMessages.add(formatted); } catch (Exception e) { @@ -137,6 +152,49 @@ public boolean sendMessage(String text) { } } + /** + * Send an item link to the Nakama channel. + */ + public boolean sendItemLink(String itemName, String description, float price) { + if (socket == null || channel == null) { + return false; + } + try { + String playerName = config.getPlayerName().isEmpty() + ? session.getUserId().substring(0, 8) + : config.getPlayerName(); + + JsonObject content = new JsonObject(); + content.addProperty("game", GAME_ID); + content.addProperty("player", playerName); + content.addProperty("type", "item_link"); + content.addProperty("name", itemName); + content.addProperty("description", description); + content.addProperty("price", price); + + socket.writeChatMessage(channel.getId(), content.toString()).get(); + return true; + } catch (Exception e) { + logger.warn("Nakama: failed to send item link", e); + return false; + } + } + + /** + * Consume the last received item link (returns null if none pending). + * Once consumed, the same link cannot be consumed again. + */ + public JsonObject consumeItemLink() { + return lastItemLink.getAndSet(null); + } + + /** + * Check if there's a pending item link without consuming it. + */ + public boolean hasItemLink() { + return lastItemLink.get() != null; + } + /** * Poll for incoming messages. Call from the game loop. * Returns null if no messages are pending. diff --git a/engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java b/engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java index ce03f078f..9463de564 100644 --- a/engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java +++ b/engine/src/main/java/org/destinationsol/game/chat/SayCommandHandler.java @@ -3,18 +3,22 @@ package org.destinationsol.game.chat; +import com.google.gson.JsonObject; +import org.destinationsol.game.SolGame; import org.destinationsol.game.console.annotations.Command; import org.destinationsol.game.console.annotations.CommandParam; import org.destinationsol.game.console.annotations.RegisterCommands; +import org.destinationsol.game.item.SolItem; +import org.destinationsol.game.ship.SolShip; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * Console command for sending chat messages via Nakama. - * Usage: say "Hello from space!" - * - * Multi-word messages must be quoted: say "Read you loud and clear." + * Console commands and static helpers for Nakama cross-game chat and item linking. */ @RegisterCommands public class SayCommandHandler { + private static final Logger logger = LoggerFactory.getLogger(SayCommandHandler.class); private static NakamaClient nakamaClient; @@ -22,12 +26,61 @@ public static void setNakamaClient(NakamaClient client) { nakamaClient = client; } + public static NakamaClient getNakamaClient() { + return nakamaClient; + } + @Command(shortDescription = "Send a message to the Bifrost chat channel") public String say(@CommandParam(value = "message") String message) { if (nakamaClient == null || !nakamaClient.isConnected()) { - return "Nakama not connected. Enable with -Dnakama.enabled=true"; + return "Nakama not connected. Enable with nakama.ini"; } boolean sent = nakamaClient.sendMessage(message); return sent ? "Sent: " + message : "Failed to send message"; } + + /** + * Called by the Beam Out inventory button — shares selected item as an item link. + */ + public static void beamOutItem(SolItem item) { + if (nakamaClient == null || !nakamaClient.isConnected()) { + logger.warn("Beam Out: Nakama not connected"); + return; + } + boolean sent = nakamaClient.sendItemLink( + item.getDisplayName(), + item.getDescription(), + item.getPrice() + ); + if (sent) { + logger.info("Beam Out: sent [{}]", item.getDisplayName()); + } + } + + /** + * Called by the Beam In inventory button — materializes last received item link + * as a money token representing the item's value. + */ + public static void beamInItem(SolGame game, SolShip target) { + if (nakamaClient == null) { + return; + } + JsonObject link = nakamaClient.consumeItemLink(); + if (link == null) { + logger.info("Beam In: no item link pending"); + return; + } + String itemName = link.has("name") ? link.get("name").getAsString() : "Unknown"; + float price = link.has("price") ? link.get("price").getAsFloat() : 10f; + String sourceGame = link.has("game") ? link.get("game").getAsString() : "unknown"; + + // Create a money token representing the beamed item's trade value + SolItem token = game.getItemMan().moneyItem(price); + if (target.getItemContainer().canAdd(token)) { + target.getItemContainer().add(token); + logger.info("Beam In: materialized [{}] from {} as {} credits", itemName, sourceGame, price); + } else { + logger.warn("Beam In: inventory full, could not materialize [{}]", itemName); + } + } } diff --git a/engine/src/main/java/org/destinationsol/game/screens/ShowInventory.java b/engine/src/main/java/org/destinationsol/game/screens/ShowInventory.java index 216c3266a..491b967e6 100644 --- a/engine/src/main/java/org/destinationsol/game/screens/ShowInventory.java +++ b/engine/src/main/java/org/destinationsol/game/screens/ShowInventory.java @@ -33,7 +33,7 @@ * You can also equip and de-equip items here, as well as force the ship to drop those items out into space. */ public class ShowInventory extends InventoryOperationsScreen { - private final UIButton[] actionButtons = new UIButton[3]; + private final UIButton[] actionButtons = new UIButton[5]; private SolShip target; @@ -90,9 +90,29 @@ public void initialise(SolApplication solApplication, InventoryScreen inventoryS inventoryScreen.setSelected(newSelection); }); + UIWarnButton beamOutButton = new UIWarnButton(); + beamOutButton.setText("Beam Out"); + beamOutButton.subscribe(button -> { + SolItem selItem = inventoryScreen.getSelectedItem(); + if (selItem == null) { + return; + } + org.destinationsol.game.chat.SayCommandHandler.beamOutItem(selItem); + }); + + UIWarnButton beamInButton = new UIWarnButton(); + beamInButton.setText("Beam In"); + beamInButton.subscribe(button -> { + SolGame game = solApplication.getGame(); + org.destinationsol.game.chat.SayCommandHandler.beamInItem(game, target); + inventoryScreen.updateItemRows(); + }); + actionButtons[0] = equip1Button; actionButtons[1] = equip2Button; actionButtons[2] = dropButton; + actionButtons[3] = beamOutButton; + actionButtons[4] = beamInButton; } @Override @@ -136,12 +156,27 @@ public void update(SolApplication solApplication, InventoryScreen inventoryScree UIButton equip1Button = actionButtons[0]; UIButton equip2Button = actionButtons[1]; UIButton dropButton = actionButtons[2]; + UIButton beamOutButton = actionButtons[3]; + UIButton beamInButton = actionButtons[4]; equip1Button.setText("---"); equip1Button.setEnabled(false); equip2Button.setText("---"); equip2Button.setEnabled(false); dropButton.setEnabled(false); + beamOutButton.setEnabled(false); + beamInButton.setEnabled(false); + + // Beam In is available when there's a pending item link, even without selection + org.destinationsol.game.chat.NakamaClient nc = + org.destinationsol.game.chat.SayCommandHandler.getNakamaClient(); + boolean hasLink = nc != null && nc.hasItemLink(); + beamInButton.setEnabled(hasLink); + if (hasLink) { + beamInButton.setText("Beam In!"); + } else { + beamInButton.setText("Beam In"); + } if (selItem == null || target == null) { return; @@ -149,6 +184,11 @@ public void update(SolApplication solApplication, InventoryScreen inventoryScree dropButton.setEnabled(true); + // Beam Out needs a selected item and Nakama connection + if (nc != null && nc.isConnected()) { + beamOutButton.setEnabled(true); + } + boolean equipped1 = target.maybeUnequip(game, selItem, false, false); boolean canEquip1 = target.maybeEquip(game, selItem, false, false); boolean equipped2 = target.maybeUnequip(game, selItem, true, false); diff --git a/engine/src/main/resources/nakama.ini b/engine/src/main/resources/nakama.ini index 7a3ec644b..7e2fad9bc 100644 --- a/engine/src/main/resources/nakama.ini +++ b/engine/src/main/resources/nakama.ini @@ -1,8 +1,8 @@ # Nakama / Bifrost cross-game chat configuration # Set enabled=true and configure host/ports to connect to a Nakama server -enabled=false +enabled=true host=localhost -grpcPort=7349 -wsPort=7350 +grpcPort=31047 +wsPort=31839 channel=bifrost.lobby -playerName= +playerName=Bob diff --git a/gradle.properties b/gradle.properties index 37d196b5d..e3ac9314b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,8 @@ org.gradle.jvmargs=-Xms128m -Xmx1024m org.gradle.configureondemand=true + + systemProp.nakama.enabled=true + systemProp.nakama.host=localhost + systemProp.nakama.grpcPort=31047 + systemProp.nakama.wsPort=31839 + \ No newline at end of file