From 2c8cbfdc8c36ff526bd586e98ae9cbb645863aa9 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 18 Jun 2022 18:38:57 -0400 Subject: [PATCH] party: switch to protobuf This switches party and member ids to also be 64bit ints. This uses considerably less data and cpu due to being able to use binary websocket frames, and the server can avoid json deserialization completely. Also hold member ids instead of party member references in the party plugin, since the members can be reset if connection is lost, causing it hold refs to old party members. Encode location update points into a single int, since the updates are so frequent. --- runelite-client/pom.xml | 6 + .../runelite/client/events/PartyChanged.java | 9 +- .../client/events/PartyMemberAvatar.java | 3 +- .../java/net/runelite/client/party/Party.java | 2888 +++++++++++++++++ .../runelite/client/party/PartyMember.java | 4 +- .../runelite/client/party/PartyService.java | 80 +- .../net/runelite/client/party/WSClient.java | 106 +- .../client/party/WebsocketGsonFactory.java | 12 +- .../party/{messages => events}/UserJoin.java | 12 +- .../party/{messages => events}/UserPart.java | 9 +- .../client/party/messages/Handshake.java | 34 - .../runelite/client/party/messages/Join.java | 37 - .../runelite/client/party/messages/Part.java | 29 - .../party/messages/PartyMemberMessage.java | 3 +- .../client/party/messages/PartyMessage.java | 4 - .../client/party/messages/UserSync.java | 5 - .../party/messages/WebsocketMessage.java | 8 +- .../client/plugins/discord/DiscordPlugin.java | 1 - .../plugins/dpscounter/DpsCounterPlugin.java | 3 +- .../client/plugins/party/PartyMemberBox.java | 10 +- .../client/plugins/party/PartyPanel.java | 15 +- .../client/plugins/party/PartyPlugin.java | 50 +- .../plugins/party/PartyPluginService.java | 3 +- .../plugins/party/PartyPluginServiceImpl.java | 3 +- .../client/plugins/party/data/PartyData.java | 3 +- .../party/messages/LocationUpdate.java | 23 +- .../specialcounter/SpecialCounterPlugin.java | 3 +- .../net/runelite/client/runelite.properties | 2 +- suppressions.xml | 3 +- 29 files changed, 3087 insertions(+), 281 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/party/Party.java rename runelite-client/src/main/java/net/runelite/client/party/{messages => events}/UserJoin.java (84%) rename runelite-client/src/main/java/net/runelite/client/party/{messages => events}/UserPart.java (86%) delete mode 100644 runelite-client/src/main/java/net/runelite/client/party/messages/Handshake.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/party/messages/Join.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/party/messages/Part.java diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index f2df804d8b..9071ba6042 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -143,6 +143,11 @@ 23.0.0 provided + + com.google.protobuf + protobuf-javalite + 3.21.1 + @@ -488,6 +493,7 @@ true **/RuntimeTypeAdapterFactory.java + net/runelite/client/party/Party.java diff --git a/runelite-client/src/main/java/net/runelite/client/events/PartyChanged.java b/runelite-client/src/main/java/net/runelite/client/events/PartyChanged.java index be8bd63a9b..1b210e52a6 100644 --- a/runelite-client/src/main/java/net/runelite/client/events/PartyChanged.java +++ b/runelite-client/src/main/java/net/runelite/client/events/PartyChanged.java @@ -24,12 +24,17 @@ */ package net.runelite.client.events; -import java.util.UUID; import lombok.Value; @Value public class PartyChanged { + /** + * The passphrase used to derive the party id + */ private final String passphrase; - private final UUID partyId; + /** + * The new party id, or null if no party + */ + private final Long partyId; } diff --git a/runelite-client/src/main/java/net/runelite/client/events/PartyMemberAvatar.java b/runelite-client/src/main/java/net/runelite/client/events/PartyMemberAvatar.java index d1c44c87d5..77735b7772 100644 --- a/runelite-client/src/main/java/net/runelite/client/events/PartyMemberAvatar.java +++ b/runelite-client/src/main/java/net/runelite/client/events/PartyMemberAvatar.java @@ -25,12 +25,11 @@ package net.runelite.client.events; import java.awt.image.BufferedImage; -import java.util.UUID; import lombok.Value; @Value public class PartyMemberAvatar { - private final UUID memberId; + private final long memberId; private final BufferedImage image; } diff --git a/runelite-client/src/main/java/net/runelite/client/party/Party.java b/runelite-client/src/main/java/net/runelite/client/party/Party.java new file mode 100644 index 0000000000..ab0e2819eb --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/party/Party.java @@ -0,0 +1,2888 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: party.proto + +package net.runelite.client.party; + +/* public */ final class Party { + private Party() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + public interface JoinOrBuilder extends + // @@protoc_insertion_point(interface_extends:party.Join) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * int64 partyId = 1; + * @return The partyId. + */ + long getPartyId(); + + /** + * int64 memberId = 2; + * @return The memberId. + */ + long getMemberId(); + } + /** + *
+   * c->s
+   * 
+ * + * Protobuf type {@code party.Join} + */ + public static final class Join extends + com.google.protobuf.GeneratedMessageLite< + Join, Join.Builder> implements + // @@protoc_insertion_point(message_implements:party.Join) + JoinOrBuilder { + private Join() { + } + public static final int PARTYID_FIELD_NUMBER = 1; + private long partyId_; + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return partyId_; + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + */ + private void setPartyId(long value) { + + partyId_ = value; + } + /** + * int64 partyId = 1; + */ + private void clearPartyId() { + + partyId_ = 0L; + } + + public static final int MEMBERID_FIELD_NUMBER = 2; + private long memberId_; + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return memberId_; + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + */ + private void setMemberId(long value) { + + memberId_ = value; + } + /** + * int64 memberId = 2; + */ + private void clearMemberId() { + + memberId_ = 0L; + } + + public static net.runelite.client.party.Party.Join parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Join parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Join parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Join parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Join parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Join parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Join parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Join parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.Join parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Join parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.Join parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Join parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.Join prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + *
+     * c->s
+     * 
+ * + * Protobuf type {@code party.Join} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.Join, Builder> implements + // @@protoc_insertion_point(builder_implements:party.Join) + net.runelite.client.party.Party.JoinOrBuilder { + // Construct using net.runelite.client.party.Party.Join.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return instance.getPartyId(); + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + * @return This builder for chaining. + */ + public Builder setPartyId(long value) { + copyOnWrite(); + instance.setPartyId(value); + return this; + } + /** + * int64 partyId = 1; + * @return This builder for chaining. + */ + public Builder clearPartyId() { + copyOnWrite(); + instance.clearPartyId(); + return this; + } + + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return instance.getMemberId(); + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + * @return This builder for chaining. + */ + public Builder setMemberId(long value) { + copyOnWrite(); + instance.setMemberId(value); + return this; + } + /** + * int64 memberId = 2; + * @return This builder for chaining. + */ + public Builder clearMemberId() { + copyOnWrite(); + instance.clearMemberId(); + return this; + } + + // @@protoc_insertion_point(builder_scope:party.Join) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.Join(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "partyId_", + "memberId_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u0002\u0002\u0002" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.Join.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.Join) + private static final net.runelite.client.party.Party.Join DEFAULT_INSTANCE; + static { + Join defaultInstance = new Join(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Join.class, defaultInstance); + } + + public static net.runelite.client.party.Party.Join getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface PartOrBuilder extends + // @@protoc_insertion_point(interface_extends:party.Part) + com.google.protobuf.MessageLiteOrBuilder { + } + /** + * Protobuf type {@code party.Part} + */ + public static final class Part extends + com.google.protobuf.GeneratedMessageLite< + Part, Part.Builder> implements + // @@protoc_insertion_point(message_implements:party.Part) + PartOrBuilder { + private Part() { + } + public static net.runelite.client.party.Party.Part parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Part parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Part parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Part parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Part parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Part parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Part parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Part parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.Part parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Part parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.Part parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Part parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.Part prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code party.Part} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.Part, Builder> implements + // @@protoc_insertion_point(builder_implements:party.Part) + net.runelite.client.party.Party.PartOrBuilder { + // Construct using net.runelite.client.party.Party.Part.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + // @@protoc_insertion_point(builder_scope:party.Part) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.Part(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = null;java.lang.String info = + "\u0000\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.Part.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.Part) + private static final net.runelite.client.party.Party.Part DEFAULT_INSTANCE; + static { + Part defaultInstance = new Part(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Part.class, defaultInstance); + } + + public static net.runelite.client.party.Party.Part getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface DataOrBuilder extends + // @@protoc_insertion_point(interface_extends:party.Data) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * bytes data = 1; + * @return The data. + */ + com.google.protobuf.ByteString getData(); + } + /** + * Protobuf type {@code party.Data} + */ + public static final class Data extends + com.google.protobuf.GeneratedMessageLite< + Data, Data.Builder> implements + // @@protoc_insertion_point(message_implements:party.Data) + DataOrBuilder { + private Data() { + data_ = com.google.protobuf.ByteString.EMPTY; + } + public static final int DATA_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString data_; + /** + * bytes data = 1; + * @return The data. + */ + @java.lang.Override + public com.google.protobuf.ByteString getData() { + return data_; + } + /** + * bytes data = 1; + * @param value The data to set. + */ + private void setData(com.google.protobuf.ByteString value) { + java.lang.Class valueClass = value.getClass(); + + data_ = value; + } + /** + * bytes data = 1; + */ + private void clearData() { + + data_ = getDefaultInstance().getData(); + } + + public static net.runelite.client.party.Party.Data parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Data parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Data parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Data parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Data parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.Data parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.Data parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Data parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.Data parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Data parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.Data parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.Data parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.Data prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code party.Data} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.Data, Builder> implements + // @@protoc_insertion_point(builder_implements:party.Data) + net.runelite.client.party.Party.DataOrBuilder { + // Construct using net.runelite.client.party.Party.Data.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * bytes data = 1; + * @return The data. + */ + @java.lang.Override + public com.google.protobuf.ByteString getData() { + return instance.getData(); + } + /** + * bytes data = 1; + * @param value The data to set. + * @return This builder for chaining. + */ + public Builder setData(com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setData(value); + return this; + } + /** + * bytes data = 1; + * @return This builder for chaining. + */ + public Builder clearData() { + copyOnWrite(); + instance.clearData(); + return this; + } + + // @@protoc_insertion_point(builder_scope:party.Data) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.Data(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "data_", + }; + java.lang.String info = + "\u0000\u0001\u0000\u0000\u0001\u0001\u0001\u0000\u0000\u0000\u0001\n"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.Data.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.Data) + private static final net.runelite.client.party.Party.Data DEFAULT_INSTANCE; + static { + Data defaultInstance = new Data(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + Data.class, defaultInstance); + } + + public static net.runelite.client.party.Party.Data getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface C2SOrBuilder extends + // @@protoc_insertion_point(interface_extends:party.C2S) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * .party.Join join = 1; + * @return Whether the join field is set. + */ + boolean hasJoin(); + /** + * .party.Join join = 1; + * @return The join. + */ + net.runelite.client.party.Party.Join getJoin(); + + /** + * .party.Part part = 2; + * @return Whether the part field is set. + */ + boolean hasPart(); + /** + * .party.Part part = 2; + * @return The part. + */ + net.runelite.client.party.Party.Part getPart(); + + /** + * .party.Data data = 3; + * @return Whether the data field is set. + */ + boolean hasData(); + /** + * .party.Data data = 3; + * @return The data. + */ + net.runelite.client.party.Party.Data getData(); + + public net.runelite.client.party.Party.C2S.MsgCase getMsgCase(); + } + /** + * Protobuf type {@code party.C2S} + */ + public static final class C2S extends + com.google.protobuf.GeneratedMessageLite< + C2S, C2S.Builder> implements + // @@protoc_insertion_point(message_implements:party.C2S) + C2SOrBuilder { + private C2S() { + } + private int msgCase_ = 0; + private java.lang.Object msg_; + public enum MsgCase { + JOIN(1), + PART(2), + DATA(3), + MSG_NOT_SET(0); + private final int value; + private MsgCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MsgCase valueOf(int value) { + return forNumber(value); + } + + public static MsgCase forNumber(int value) { + switch (value) { + case 1: return JOIN; + case 2: return PART; + case 3: return DATA; + case 0: return MSG_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + @java.lang.Override + public MsgCase + getMsgCase() { + return MsgCase.forNumber( + msgCase_); + } + + private void clearMsg() { + msgCase_ = 0; + msg_ = null; + } + + public static final int JOIN_FIELD_NUMBER = 1; + /** + * .party.Join join = 1; + */ + @java.lang.Override + public boolean hasJoin() { + return msgCase_ == 1; + } + /** + * .party.Join join = 1; + */ + @java.lang.Override + public net.runelite.client.party.Party.Join getJoin() { + if (msgCase_ == 1) { + return (net.runelite.client.party.Party.Join) msg_; + } + return net.runelite.client.party.Party.Join.getDefaultInstance(); + } + /** + * .party.Join join = 1; + */ + private void setJoin(net.runelite.client.party.Party.Join value) { + value.getClass(); + msg_ = value; + msgCase_ = 1; + } + /** + * .party.Join join = 1; + */ + private void mergeJoin(net.runelite.client.party.Party.Join value) { + value.getClass(); + if (msgCase_ == 1 && + msg_ != net.runelite.client.party.Party.Join.getDefaultInstance()) { + msg_ = net.runelite.client.party.Party.Join.newBuilder((net.runelite.client.party.Party.Join) msg_) + .mergeFrom(value).buildPartial(); + } else { + msg_ = value; + } + msgCase_ = 1; + } + /** + * .party.Join join = 1; + */ + private void clearJoin() { + if (msgCase_ == 1) { + msgCase_ = 0; + msg_ = null; + } + } + + public static final int PART_FIELD_NUMBER = 2; + /** + * .party.Part part = 2; + */ + @java.lang.Override + public boolean hasPart() { + return msgCase_ == 2; + } + /** + * .party.Part part = 2; + */ + @java.lang.Override + public net.runelite.client.party.Party.Part getPart() { + if (msgCase_ == 2) { + return (net.runelite.client.party.Party.Part) msg_; + } + return net.runelite.client.party.Party.Part.getDefaultInstance(); + } + /** + * .party.Part part = 2; + */ + private void setPart(net.runelite.client.party.Party.Part value) { + value.getClass(); + msg_ = value; + msgCase_ = 2; + } + /** + * .party.Part part = 2; + */ + private void mergePart(net.runelite.client.party.Party.Part value) { + value.getClass(); + if (msgCase_ == 2 && + msg_ != net.runelite.client.party.Party.Part.getDefaultInstance()) { + msg_ = net.runelite.client.party.Party.Part.newBuilder((net.runelite.client.party.Party.Part) msg_) + .mergeFrom(value).buildPartial(); + } else { + msg_ = value; + } + msgCase_ = 2; + } + /** + * .party.Part part = 2; + */ + private void clearPart() { + if (msgCase_ == 2) { + msgCase_ = 0; + msg_ = null; + } + } + + public static final int DATA_FIELD_NUMBER = 3; + /** + * .party.Data data = 3; + */ + @java.lang.Override + public boolean hasData() { + return msgCase_ == 3; + } + /** + * .party.Data data = 3; + */ + @java.lang.Override + public net.runelite.client.party.Party.Data getData() { + if (msgCase_ == 3) { + return (net.runelite.client.party.Party.Data) msg_; + } + return net.runelite.client.party.Party.Data.getDefaultInstance(); + } + /** + * .party.Data data = 3; + */ + private void setData(net.runelite.client.party.Party.Data value) { + value.getClass(); + msg_ = value; + msgCase_ = 3; + } + /** + * .party.Data data = 3; + */ + private void mergeData(net.runelite.client.party.Party.Data value) { + value.getClass(); + if (msgCase_ == 3 && + msg_ != net.runelite.client.party.Party.Data.getDefaultInstance()) { + msg_ = net.runelite.client.party.Party.Data.newBuilder((net.runelite.client.party.Party.Data) msg_) + .mergeFrom(value).buildPartial(); + } else { + msg_ = value; + } + msgCase_ = 3; + } + /** + * .party.Data data = 3; + */ + private void clearData() { + if (msgCase_ == 3) { + msgCase_ = 0; + msg_ = null; + } + } + + public static net.runelite.client.party.Party.C2S parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.C2S parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.C2S parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.C2S parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.C2S parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.C2S parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.C2S parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.C2S parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.C2S parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.C2S parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.C2S parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.C2S parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.C2S prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code party.C2S} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.C2S, Builder> implements + // @@protoc_insertion_point(builder_implements:party.C2S) + net.runelite.client.party.Party.C2SOrBuilder { + // Construct using net.runelite.client.party.Party.C2S.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + @java.lang.Override + public MsgCase + getMsgCase() { + return instance.getMsgCase(); + } + + public Builder clearMsg() { + copyOnWrite(); + instance.clearMsg(); + return this; + } + + + /** + * .party.Join join = 1; + */ + @java.lang.Override + public boolean hasJoin() { + return instance.hasJoin(); + } + /** + * .party.Join join = 1; + */ + @java.lang.Override + public net.runelite.client.party.Party.Join getJoin() { + return instance.getJoin(); + } + /** + * .party.Join join = 1; + */ + public Builder setJoin(net.runelite.client.party.Party.Join value) { + copyOnWrite(); + instance.setJoin(value); + return this; + } + /** + * .party.Join join = 1; + */ + public Builder setJoin( + net.runelite.client.party.Party.Join.Builder builderForValue) { + copyOnWrite(); + instance.setJoin(builderForValue.build()); + return this; + } + /** + * .party.Join join = 1; + */ + public Builder mergeJoin(net.runelite.client.party.Party.Join value) { + copyOnWrite(); + instance.mergeJoin(value); + return this; + } + /** + * .party.Join join = 1; + */ + public Builder clearJoin() { + copyOnWrite(); + instance.clearJoin(); + return this; + } + + /** + * .party.Part part = 2; + */ + @java.lang.Override + public boolean hasPart() { + return instance.hasPart(); + } + /** + * .party.Part part = 2; + */ + @java.lang.Override + public net.runelite.client.party.Party.Part getPart() { + return instance.getPart(); + } + /** + * .party.Part part = 2; + */ + public Builder setPart(net.runelite.client.party.Party.Part value) { + copyOnWrite(); + instance.setPart(value); + return this; + } + /** + * .party.Part part = 2; + */ + public Builder setPart( + net.runelite.client.party.Party.Part.Builder builderForValue) { + copyOnWrite(); + instance.setPart(builderForValue.build()); + return this; + } + /** + * .party.Part part = 2; + */ + public Builder mergePart(net.runelite.client.party.Party.Part value) { + copyOnWrite(); + instance.mergePart(value); + return this; + } + /** + * .party.Part part = 2; + */ + public Builder clearPart() { + copyOnWrite(); + instance.clearPart(); + return this; + } + + /** + * .party.Data data = 3; + */ + @java.lang.Override + public boolean hasData() { + return instance.hasData(); + } + /** + * .party.Data data = 3; + */ + @java.lang.Override + public net.runelite.client.party.Party.Data getData() { + return instance.getData(); + } + /** + * .party.Data data = 3; + */ + public Builder setData(net.runelite.client.party.Party.Data value) { + copyOnWrite(); + instance.setData(value); + return this; + } + /** + * .party.Data data = 3; + */ + public Builder setData( + net.runelite.client.party.Party.Data.Builder builderForValue) { + copyOnWrite(); + instance.setData(builderForValue.build()); + return this; + } + /** + * .party.Data data = 3; + */ + public Builder mergeData(net.runelite.client.party.Party.Data value) { + copyOnWrite(); + instance.mergeData(value); + return this; + } + /** + * .party.Data data = 3; + */ + public Builder clearData() { + copyOnWrite(); + instance.clearData(); + return this; + } + + // @@protoc_insertion_point(builder_scope:party.C2S) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.C2S(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "msg_", + "msgCase_", + net.runelite.client.party.Party.Join.class, + net.runelite.client.party.Party.Part.class, + net.runelite.client.party.Party.Data.class, + }; + java.lang.String info = + "\u0000\u0003\u0001\u0000\u0001\u0003\u0003\u0000\u0000\u0000\u0001<\u0000\u0002<" + + "\u0000\u0003<\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.C2S.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.C2S) + private static final net.runelite.client.party.Party.C2S DEFAULT_INSTANCE; + static { + C2S defaultInstance = new C2S(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + C2S.class, defaultInstance); + } + + public static net.runelite.client.party.Party.C2S getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface UserJoinOrBuilder extends + // @@protoc_insertion_point(interface_extends:party.UserJoin) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * int64 partyId = 1; + * @return The partyId. + */ + long getPartyId(); + + /** + * int64 memberId = 2; + * @return The memberId. + */ + long getMemberId(); + } + /** + *
+   * s->c
+   * 
+ * + * Protobuf type {@code party.UserJoin} + */ + public static final class UserJoin extends + com.google.protobuf.GeneratedMessageLite< + UserJoin, UserJoin.Builder> implements + // @@protoc_insertion_point(message_implements:party.UserJoin) + UserJoinOrBuilder { + private UserJoin() { + } + public static final int PARTYID_FIELD_NUMBER = 1; + private long partyId_; + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return partyId_; + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + */ + private void setPartyId(long value) { + + partyId_ = value; + } + /** + * int64 partyId = 1; + */ + private void clearPartyId() { + + partyId_ = 0L; + } + + public static final int MEMBERID_FIELD_NUMBER = 2; + private long memberId_; + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return memberId_; + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + */ + private void setMemberId(long value) { + + memberId_ = value; + } + /** + * int64 memberId = 2; + */ + private void clearMemberId() { + + memberId_ = 0L; + } + + public static net.runelite.client.party.Party.UserJoin parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.UserJoin parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.UserJoin parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.UserJoin parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.UserJoin parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.UserJoin parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.UserJoin parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.UserJoin parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.UserJoin parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.UserJoin parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.UserJoin parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.UserJoin parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.UserJoin prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + *
+     * s->c
+     * 
+ * + * Protobuf type {@code party.UserJoin} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.UserJoin, Builder> implements + // @@protoc_insertion_point(builder_implements:party.UserJoin) + net.runelite.client.party.Party.UserJoinOrBuilder { + // Construct using net.runelite.client.party.Party.UserJoin.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return instance.getPartyId(); + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + * @return This builder for chaining. + */ + public Builder setPartyId(long value) { + copyOnWrite(); + instance.setPartyId(value); + return this; + } + /** + * int64 partyId = 1; + * @return This builder for chaining. + */ + public Builder clearPartyId() { + copyOnWrite(); + instance.clearPartyId(); + return this; + } + + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return instance.getMemberId(); + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + * @return This builder for chaining. + */ + public Builder setMemberId(long value) { + copyOnWrite(); + instance.setMemberId(value); + return this; + } + /** + * int64 memberId = 2; + * @return This builder for chaining. + */ + public Builder clearMemberId() { + copyOnWrite(); + instance.clearMemberId(); + return this; + } + + // @@protoc_insertion_point(builder_scope:party.UserJoin) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.UserJoin(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "partyId_", + "memberId_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u0002\u0002\u0002" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.UserJoin.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.UserJoin) + private static final net.runelite.client.party.Party.UserJoin DEFAULT_INSTANCE; + static { + UserJoin defaultInstance = new UserJoin(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + UserJoin.class, defaultInstance); + } + + public static net.runelite.client.party.Party.UserJoin getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface UserPartOrBuilder extends + // @@protoc_insertion_point(interface_extends:party.UserPart) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * int64 partyId = 1; + * @return The partyId. + */ + long getPartyId(); + + /** + * int64 memberId = 2; + * @return The memberId. + */ + long getMemberId(); + } + /** + * Protobuf type {@code party.UserPart} + */ + public static final class UserPart extends + com.google.protobuf.GeneratedMessageLite< + UserPart, UserPart.Builder> implements + // @@protoc_insertion_point(message_implements:party.UserPart) + UserPartOrBuilder { + private UserPart() { + } + public static final int PARTYID_FIELD_NUMBER = 1; + private long partyId_; + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return partyId_; + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + */ + private void setPartyId(long value) { + + partyId_ = value; + } + /** + * int64 partyId = 1; + */ + private void clearPartyId() { + + partyId_ = 0L; + } + + public static final int MEMBERID_FIELD_NUMBER = 2; + private long memberId_; + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return memberId_; + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + */ + private void setMemberId(long value) { + + memberId_ = value; + } + /** + * int64 memberId = 2; + */ + private void clearMemberId() { + + memberId_ = 0L; + } + + public static net.runelite.client.party.Party.UserPart parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.UserPart parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.UserPart parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.UserPart parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.UserPart parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.UserPart parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.UserPart parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.UserPart parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.UserPart parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.UserPart parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.UserPart parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.UserPart parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.UserPart prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code party.UserPart} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.UserPart, Builder> implements + // @@protoc_insertion_point(builder_implements:party.UserPart) + net.runelite.client.party.Party.UserPartOrBuilder { + // Construct using net.runelite.client.party.Party.UserPart.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return instance.getPartyId(); + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + * @return This builder for chaining. + */ + public Builder setPartyId(long value) { + copyOnWrite(); + instance.setPartyId(value); + return this; + } + /** + * int64 partyId = 1; + * @return This builder for chaining. + */ + public Builder clearPartyId() { + copyOnWrite(); + instance.clearPartyId(); + return this; + } + + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return instance.getMemberId(); + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + * @return This builder for chaining. + */ + public Builder setMemberId(long value) { + copyOnWrite(); + instance.setMemberId(value); + return this; + } + /** + * int64 memberId = 2; + * @return This builder for chaining. + */ + public Builder clearMemberId() { + copyOnWrite(); + instance.clearMemberId(); + return this; + } + + // @@protoc_insertion_point(builder_scope:party.UserPart) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.UserPart(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "partyId_", + "memberId_", + }; + java.lang.String info = + "\u0000\u0002\u0000\u0000\u0001\u0002\u0002\u0000\u0000\u0000\u0001\u0002\u0002\u0002" + + ""; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.UserPart.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.UserPart) + private static final net.runelite.client.party.Party.UserPart DEFAULT_INSTANCE; + static { + UserPart defaultInstance = new UserPart(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + UserPart.class, defaultInstance); + } + + public static net.runelite.client.party.Party.UserPart getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface PartyDataOrBuilder extends + // @@protoc_insertion_point(interface_extends:party.PartyData) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * int64 partyId = 1; + * @return The partyId. + */ + long getPartyId(); + + /** + * int64 memberId = 2; + * @return The memberId. + */ + long getMemberId(); + + /** + * bytes data = 3; + * @return The data. + */ + com.google.protobuf.ByteString getData(); + } + /** + * Protobuf type {@code party.PartyData} + */ + public static final class PartyData extends + com.google.protobuf.GeneratedMessageLite< + PartyData, PartyData.Builder> implements + // @@protoc_insertion_point(message_implements:party.PartyData) + PartyDataOrBuilder { + private PartyData() { + data_ = com.google.protobuf.ByteString.EMPTY; + } + public static final int PARTYID_FIELD_NUMBER = 1; + private long partyId_; + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return partyId_; + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + */ + private void setPartyId(long value) { + + partyId_ = value; + } + /** + * int64 partyId = 1; + */ + private void clearPartyId() { + + partyId_ = 0L; + } + + public static final int MEMBERID_FIELD_NUMBER = 2; + private long memberId_; + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return memberId_; + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + */ + private void setMemberId(long value) { + + memberId_ = value; + } + /** + * int64 memberId = 2; + */ + private void clearMemberId() { + + memberId_ = 0L; + } + + public static final int DATA_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString data_; + /** + * bytes data = 3; + * @return The data. + */ + @java.lang.Override + public com.google.protobuf.ByteString getData() { + return data_; + } + /** + * bytes data = 3; + * @param value The data to set. + */ + private void setData(com.google.protobuf.ByteString value) { + java.lang.Class valueClass = value.getClass(); + + data_ = value; + } + /** + * bytes data = 3; + */ + private void clearData() { + + data_ = getDefaultInstance().getData(); + } + + public static net.runelite.client.party.Party.PartyData parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.PartyData parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.PartyData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.PartyData parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.PartyData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.PartyData parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.PartyData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.PartyData parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.PartyData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.PartyData parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.PartyData parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.PartyData parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.PartyData prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code party.PartyData} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.PartyData, Builder> implements + // @@protoc_insertion_point(builder_implements:party.PartyData) + net.runelite.client.party.Party.PartyDataOrBuilder { + // Construct using net.runelite.client.party.Party.PartyData.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + + /** + * int64 partyId = 1; + * @return The partyId. + */ + @java.lang.Override + public long getPartyId() { + return instance.getPartyId(); + } + /** + * int64 partyId = 1; + * @param value The partyId to set. + * @return This builder for chaining. + */ + public Builder setPartyId(long value) { + copyOnWrite(); + instance.setPartyId(value); + return this; + } + /** + * int64 partyId = 1; + * @return This builder for chaining. + */ + public Builder clearPartyId() { + copyOnWrite(); + instance.clearPartyId(); + return this; + } + + /** + * int64 memberId = 2; + * @return The memberId. + */ + @java.lang.Override + public long getMemberId() { + return instance.getMemberId(); + } + /** + * int64 memberId = 2; + * @param value The memberId to set. + * @return This builder for chaining. + */ + public Builder setMemberId(long value) { + copyOnWrite(); + instance.setMemberId(value); + return this; + } + /** + * int64 memberId = 2; + * @return This builder for chaining. + */ + public Builder clearMemberId() { + copyOnWrite(); + instance.clearMemberId(); + return this; + } + + /** + * bytes data = 3; + * @return The data. + */ + @java.lang.Override + public com.google.protobuf.ByteString getData() { + return instance.getData(); + } + /** + * bytes data = 3; + * @param value The data to set. + * @return This builder for chaining. + */ + public Builder setData(com.google.protobuf.ByteString value) { + copyOnWrite(); + instance.setData(value); + return this; + } + /** + * bytes data = 3; + * @return This builder for chaining. + */ + public Builder clearData() { + copyOnWrite(); + instance.clearData(); + return this; + } + + // @@protoc_insertion_point(builder_scope:party.PartyData) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.PartyData(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "partyId_", + "memberId_", + "data_", + }; + java.lang.String info = + "\u0000\u0003\u0000\u0000\u0001\u0003\u0003\u0000\u0000\u0000\u0001\u0002\u0002\u0002" + + "\u0003\n"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.PartyData.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.PartyData) + private static final net.runelite.client.party.Party.PartyData DEFAULT_INSTANCE; + static { + PartyData defaultInstance = new PartyData(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + PartyData.class, defaultInstance); + } + + public static net.runelite.client.party.Party.PartyData getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + public interface S2COrBuilder extends + // @@protoc_insertion_point(interface_extends:party.S2C) + com.google.protobuf.MessageLiteOrBuilder { + + /** + * .party.UserJoin join = 1; + * @return Whether the join field is set. + */ + boolean hasJoin(); + /** + * .party.UserJoin join = 1; + * @return The join. + */ + net.runelite.client.party.Party.UserJoin getJoin(); + + /** + * .party.UserPart part = 2; + * @return Whether the part field is set. + */ + boolean hasPart(); + /** + * .party.UserPart part = 2; + * @return The part. + */ + net.runelite.client.party.Party.UserPart getPart(); + + /** + * .party.PartyData data = 3; + * @return Whether the data field is set. + */ + boolean hasData(); + /** + * .party.PartyData data = 3; + * @return The data. + */ + net.runelite.client.party.Party.PartyData getData(); + + public net.runelite.client.party.Party.S2C.MsgCase getMsgCase(); + } + /** + * Protobuf type {@code party.S2C} + */ + public static final class S2C extends + com.google.protobuf.GeneratedMessageLite< + S2C, S2C.Builder> implements + // @@protoc_insertion_point(message_implements:party.S2C) + S2COrBuilder { + private S2C() { + } + private int msgCase_ = 0; + private java.lang.Object msg_; + public enum MsgCase { + JOIN(1), + PART(2), + DATA(3), + MSG_NOT_SET(0); + private final int value; + private MsgCase(int value) { + this.value = value; + } + /** + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MsgCase valueOf(int value) { + return forNumber(value); + } + + public static MsgCase forNumber(int value) { + switch (value) { + case 1: return JOIN; + case 2: return PART; + case 3: return DATA; + case 0: return MSG_NOT_SET; + default: return null; + } + } + public int getNumber() { + return this.value; + } + }; + + @java.lang.Override + public MsgCase + getMsgCase() { + return MsgCase.forNumber( + msgCase_); + } + + private void clearMsg() { + msgCase_ = 0; + msg_ = null; + } + + public static final int JOIN_FIELD_NUMBER = 1; + /** + * .party.UserJoin join = 1; + */ + @java.lang.Override + public boolean hasJoin() { + return msgCase_ == 1; + } + /** + * .party.UserJoin join = 1; + */ + @java.lang.Override + public net.runelite.client.party.Party.UserJoin getJoin() { + if (msgCase_ == 1) { + return (net.runelite.client.party.Party.UserJoin) msg_; + } + return net.runelite.client.party.Party.UserJoin.getDefaultInstance(); + } + /** + * .party.UserJoin join = 1; + */ + private void setJoin(net.runelite.client.party.Party.UserJoin value) { + value.getClass(); + msg_ = value; + msgCase_ = 1; + } + /** + * .party.UserJoin join = 1; + */ + private void mergeJoin(net.runelite.client.party.Party.UserJoin value) { + value.getClass(); + if (msgCase_ == 1 && + msg_ != net.runelite.client.party.Party.UserJoin.getDefaultInstance()) { + msg_ = net.runelite.client.party.Party.UserJoin.newBuilder((net.runelite.client.party.Party.UserJoin) msg_) + .mergeFrom(value).buildPartial(); + } else { + msg_ = value; + } + msgCase_ = 1; + } + /** + * .party.UserJoin join = 1; + */ + private void clearJoin() { + if (msgCase_ == 1) { + msgCase_ = 0; + msg_ = null; + } + } + + public static final int PART_FIELD_NUMBER = 2; + /** + * .party.UserPart part = 2; + */ + @java.lang.Override + public boolean hasPart() { + return msgCase_ == 2; + } + /** + * .party.UserPart part = 2; + */ + @java.lang.Override + public net.runelite.client.party.Party.UserPart getPart() { + if (msgCase_ == 2) { + return (net.runelite.client.party.Party.UserPart) msg_; + } + return net.runelite.client.party.Party.UserPart.getDefaultInstance(); + } + /** + * .party.UserPart part = 2; + */ + private void setPart(net.runelite.client.party.Party.UserPart value) { + value.getClass(); + msg_ = value; + msgCase_ = 2; + } + /** + * .party.UserPart part = 2; + */ + private void mergePart(net.runelite.client.party.Party.UserPart value) { + value.getClass(); + if (msgCase_ == 2 && + msg_ != net.runelite.client.party.Party.UserPart.getDefaultInstance()) { + msg_ = net.runelite.client.party.Party.UserPart.newBuilder((net.runelite.client.party.Party.UserPart) msg_) + .mergeFrom(value).buildPartial(); + } else { + msg_ = value; + } + msgCase_ = 2; + } + /** + * .party.UserPart part = 2; + */ + private void clearPart() { + if (msgCase_ == 2) { + msgCase_ = 0; + msg_ = null; + } + } + + public static final int DATA_FIELD_NUMBER = 3; + /** + * .party.PartyData data = 3; + */ + @java.lang.Override + public boolean hasData() { + return msgCase_ == 3; + } + /** + * .party.PartyData data = 3; + */ + @java.lang.Override + public net.runelite.client.party.Party.PartyData getData() { + if (msgCase_ == 3) { + return (net.runelite.client.party.Party.PartyData) msg_; + } + return net.runelite.client.party.Party.PartyData.getDefaultInstance(); + } + /** + * .party.PartyData data = 3; + */ + private void setData(net.runelite.client.party.Party.PartyData value) { + value.getClass(); + msg_ = value; + msgCase_ = 3; + } + /** + * .party.PartyData data = 3; + */ + private void mergeData(net.runelite.client.party.Party.PartyData value) { + value.getClass(); + if (msgCase_ == 3 && + msg_ != net.runelite.client.party.Party.PartyData.getDefaultInstance()) { + msg_ = net.runelite.client.party.Party.PartyData.newBuilder((net.runelite.client.party.Party.PartyData) msg_) + .mergeFrom(value).buildPartial(); + } else { + msg_ = value; + } + msgCase_ = 3; + } + /** + * .party.PartyData data = 3; + */ + private void clearData() { + if (msgCase_ == 3) { + msgCase_ = 0; + msg_ = null; + } + } + + public static net.runelite.client.party.Party.S2C parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.S2C parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.S2C parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.S2C parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.S2C parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data); + } + public static net.runelite.client.party.Party.S2C parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, data, extensionRegistry); + } + public static net.runelite.client.party.Party.S2C parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.S2C parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.S2C parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.S2C parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return parseDelimitedFrom(DEFAULT_INSTANCE, input, extensionRegistry); + } + public static net.runelite.client.party.Party.S2C parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input); + } + public static net.runelite.client.party.Party.S2C parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageLite.parseFrom( + DEFAULT_INSTANCE, input, extensionRegistry); + } + + public static Builder newBuilder() { + return (Builder) DEFAULT_INSTANCE.createBuilder(); + } + public static Builder newBuilder(net.runelite.client.party.Party.S2C prototype) { + return (Builder) DEFAULT_INSTANCE.createBuilder(prototype); + } + + /** + * Protobuf type {@code party.S2C} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + net.runelite.client.party.Party.S2C, Builder> implements + // @@protoc_insertion_point(builder_implements:party.S2C) + net.runelite.client.party.Party.S2COrBuilder { + // Construct using net.runelite.client.party.Party.S2C.newBuilder() + private Builder() { + super(DEFAULT_INSTANCE); + } + + @java.lang.Override + public MsgCase + getMsgCase() { + return instance.getMsgCase(); + } + + public Builder clearMsg() { + copyOnWrite(); + instance.clearMsg(); + return this; + } + + + /** + * .party.UserJoin join = 1; + */ + @java.lang.Override + public boolean hasJoin() { + return instance.hasJoin(); + } + /** + * .party.UserJoin join = 1; + */ + @java.lang.Override + public net.runelite.client.party.Party.UserJoin getJoin() { + return instance.getJoin(); + } + /** + * .party.UserJoin join = 1; + */ + public Builder setJoin(net.runelite.client.party.Party.UserJoin value) { + copyOnWrite(); + instance.setJoin(value); + return this; + } + /** + * .party.UserJoin join = 1; + */ + public Builder setJoin( + net.runelite.client.party.Party.UserJoin.Builder builderForValue) { + copyOnWrite(); + instance.setJoin(builderForValue.build()); + return this; + } + /** + * .party.UserJoin join = 1; + */ + public Builder mergeJoin(net.runelite.client.party.Party.UserJoin value) { + copyOnWrite(); + instance.mergeJoin(value); + return this; + } + /** + * .party.UserJoin join = 1; + */ + public Builder clearJoin() { + copyOnWrite(); + instance.clearJoin(); + return this; + } + + /** + * .party.UserPart part = 2; + */ + @java.lang.Override + public boolean hasPart() { + return instance.hasPart(); + } + /** + * .party.UserPart part = 2; + */ + @java.lang.Override + public net.runelite.client.party.Party.UserPart getPart() { + return instance.getPart(); + } + /** + * .party.UserPart part = 2; + */ + public Builder setPart(net.runelite.client.party.Party.UserPart value) { + copyOnWrite(); + instance.setPart(value); + return this; + } + /** + * .party.UserPart part = 2; + */ + public Builder setPart( + net.runelite.client.party.Party.UserPart.Builder builderForValue) { + copyOnWrite(); + instance.setPart(builderForValue.build()); + return this; + } + /** + * .party.UserPart part = 2; + */ + public Builder mergePart(net.runelite.client.party.Party.UserPart value) { + copyOnWrite(); + instance.mergePart(value); + return this; + } + /** + * .party.UserPart part = 2; + */ + public Builder clearPart() { + copyOnWrite(); + instance.clearPart(); + return this; + } + + /** + * .party.PartyData data = 3; + */ + @java.lang.Override + public boolean hasData() { + return instance.hasData(); + } + /** + * .party.PartyData data = 3; + */ + @java.lang.Override + public net.runelite.client.party.Party.PartyData getData() { + return instance.getData(); + } + /** + * .party.PartyData data = 3; + */ + public Builder setData(net.runelite.client.party.Party.PartyData value) { + copyOnWrite(); + instance.setData(value); + return this; + } + /** + * .party.PartyData data = 3; + */ + public Builder setData( + net.runelite.client.party.Party.PartyData.Builder builderForValue) { + copyOnWrite(); + instance.setData(builderForValue.build()); + return this; + } + /** + * .party.PartyData data = 3; + */ + public Builder mergeData(net.runelite.client.party.Party.PartyData value) { + copyOnWrite(); + instance.mergeData(value); + return this; + } + /** + * .party.PartyData data = 3; + */ + public Builder clearData() { + copyOnWrite(); + instance.clearData(); + return this; + } + + // @@protoc_insertion_point(builder_scope:party.S2C) + } + @java.lang.Override + @java.lang.SuppressWarnings({"unchecked", "fallthrough"}) + protected final java.lang.Object dynamicMethod( + com.google.protobuf.GeneratedMessageLite.MethodToInvoke method, + java.lang.Object arg0, java.lang.Object arg1) { + switch (method) { + case NEW_MUTABLE_INSTANCE: { + return new net.runelite.client.party.Party.S2C(); + } + case NEW_BUILDER: { + return new Builder(); + } + case BUILD_MESSAGE_INFO: { + java.lang.Object[] objects = new java.lang.Object[] { + "msg_", + "msgCase_", + net.runelite.client.party.Party.UserJoin.class, + net.runelite.client.party.Party.UserPart.class, + net.runelite.client.party.Party.PartyData.class, + }; + java.lang.String info = + "\u0000\u0003\u0001\u0000\u0001\u0003\u0003\u0000\u0000\u0000\u0001<\u0000\u0002<" + + "\u0000\u0003<\u0000"; + return newMessageInfo(DEFAULT_INSTANCE, info, objects); + } + // fall through + case GET_DEFAULT_INSTANCE: { + return DEFAULT_INSTANCE; + } + case GET_PARSER: { + com.google.protobuf.Parser parser = PARSER; + if (parser == null) { + synchronized (net.runelite.client.party.Party.S2C.class) { + parser = PARSER; + if (parser == null) { + parser = + new DefaultInstanceBasedParser( + DEFAULT_INSTANCE); + PARSER = parser; + } + } + } + return parser; + } + case GET_MEMOIZED_IS_INITIALIZED: { + return (byte) 1; + } + case SET_MEMOIZED_IS_INITIALIZED: { + return null; + } + } + throw new UnsupportedOperationException(); + } + + + // @@protoc_insertion_point(class_scope:party.S2C) + private static final net.runelite.client.party.Party.S2C DEFAULT_INSTANCE; + static { + S2C defaultInstance = new S2C(); + // New instances are implicitly immutable so no need to make + // immutable. + DEFAULT_INSTANCE = defaultInstance; + com.google.protobuf.GeneratedMessageLite.registerDefaultInstance( + S2C.class, defaultInstance); + } + + public static net.runelite.client.party.Party.S2C getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static volatile com.google.protobuf.Parser PARSER; + + public static com.google.protobuf.Parser parser() { + return DEFAULT_INSTANCE.getParserForType(); + } + } + + + static { + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/runelite-client/src/main/java/net/runelite/client/party/PartyMember.java b/runelite-client/src/main/java/net/runelite/client/party/PartyMember.java index 70789f58f5..ee0845a57b 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/PartyMember.java +++ b/runelite-client/src/main/java/net/runelite/client/party/PartyMember.java @@ -25,14 +25,12 @@ package net.runelite.client.party; import java.awt.image.BufferedImage; -import java.util.UUID; import lombok.Data; @Data public class PartyMember { - private final UUID memberId; - private final String name; + private final long memberId; private String displayName = ""; private boolean loggedIn; private BufferedImage avatar; diff --git a/runelite-client/src/main/java/net/runelite/client/party/PartyService.java b/runelite-client/src/main/java/net/runelite/client/party/PartyService.java index 9c02062eba..9b3a810374 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/PartyService.java +++ b/runelite-client/src/main/java/net/runelite/client/party/PartyService.java @@ -50,14 +50,11 @@ import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.PartyChanged; import net.runelite.client.events.PartyMemberAvatar; -import net.runelite.client.party.messages.Join; -import net.runelite.client.party.messages.Part; import net.runelite.client.party.messages.PartyChatMessage; import net.runelite.client.party.messages.PartyMessage; -import net.runelite.client.party.messages.UserJoin; -import net.runelite.client.party.messages.UserPart; +import net.runelite.client.party.events.UserJoin; +import net.runelite.client.party.events.UserPart; import net.runelite.client.party.messages.UserSync; -import net.runelite.client.util.Text; import static net.runelite.client.util.Text.JAGEX_PRINTABLE_CHAR_MATCHER; @Slf4j @@ -65,8 +62,6 @@ public class PartyService { private static final int MAX_MESSAGE_LEN = 150; - private static final int MAX_USERNAME_LEN = 32; // same as Discord - private static final String USERNAME = "rluser-" + new Random().nextInt(Integer.MAX_VALUE); private static final String ALPHABET = "bcdfghjklmnpqrstvwxyz"; private final Client client; @@ -76,7 +71,8 @@ public class PartyService private final List members = new ArrayList<>(); @Getter - private UUID partyId; // secret party id + private long partyId; // secret party id + private long memberId = randomMemberId(); @Getter private String partyPassphrase; @@ -146,7 +142,7 @@ public String generatePassphrase() } String partyPassphrase = sb.toString(); - log.debug("Generated party passpharse {}", partyPassphrase); + log.debug("Generated party passphrase {}", partyPassphrase); return partyPassphrase; } @@ -154,20 +150,21 @@ public void changeParty(@Nullable String passphrase) { if (wsClient.sessionExists()) { - wsClient.send(new Part()); + wsClient.part(); + memberId = randomMemberId(); // use a different member id between parties } - UUID id = passphrase != null ? passphraseToId(passphrase) : null; + long id = passphrase != null ? passphraseToId(passphrase) : 0; log.debug("Party change to {} (id {})", passphrase, id); members.clear(); partyId = id; partyPassphrase = passphrase; - if (partyId == null) + if (passphrase == null) { wsClient.changeSession(null); - eventBus.post(new PartyChanged(partyPassphrase, partyId)); + eventBus.post(new PartyChanged(partyPassphrase, null)); return; } @@ -178,7 +175,7 @@ public void changeParty(@Nullable String passphrase) } eventBus.post(new PartyChanged(partyPassphrase, partyId)); - wsClient.send(new Join(partyId, USERNAME)); + wsClient.join(partyId, memberId); } public void send(T message) @@ -187,11 +184,10 @@ public void send(T message) { log.debug("Reconnecting to server"); - PartyMember local = getLocalMember(); - members.removeIf(m -> m != local); + members.clear(); wsClient.connect(); - wsClient.send(new Join(partyId, USERNAME)); + wsClient.join(partyId, memberId); } wsClient.send(message); @@ -200,7 +196,7 @@ public void send(T message) @Subscribe(priority = 1) // run prior to plugins so that the member is joined by the time the plugins see it. public void onUserJoin(final UserJoin message) { - if (!partyId.equals(message.getPartyId())) + if (partyId != message.getPartyId()) { // This can happen when a session is resumed server side after the client party // changes when disconnected. @@ -210,7 +206,7 @@ public void onUserJoin(final UserJoin message) PartyMember partyMember = getMemberById(message.getMemberId()); if (partyMember == null) { - partyMember = new PartyMember(message.getMemberId(), cleanUsername(message.getName())); + partyMember = new PartyMember(message.getMemberId()); members.add(partyMember); log.debug("User {} joins party, {} members", partyMember, members.size()); } @@ -219,8 +215,8 @@ public void onUserJoin(final UserJoin message) // Send info to other clients that this user successfully finished joining party if (localMember != null && localMember == partyMember) { + log.debug("Requesting sync"); final UserSync userSync = new UserSync(); - userSync.setMemberId(message.getMemberId()); wsClient.send(userSync); } } @@ -228,7 +224,7 @@ public void onUserJoin(final UserJoin message) @Subscribe(priority = 1) // run prior to plugins so that the member is removed by the time the plugins see it. public void onUserPart(final UserPart message) { - if (members.removeIf(member -> member.getMemberId().equals(message.getMemberId()))) + if (members.removeIf(member -> member.getMemberId() == message.getMemberId())) { log.debug("User {} leaves party, {} members", message.getMemberId(), members.size()); } @@ -264,27 +260,14 @@ public void onPartyChatMessage(final PartyChatMessage message) public PartyMember getLocalMember() { - return getMemberByName(USERNAME); + return getMemberById(memberId); } - public PartyMember getMemberById(final UUID id) + public PartyMember getMemberById(final long id) { for (PartyMember member : members) { - if (id.equals(member.getMemberId())) - { - return member; - } - } - - return null; - } - - public PartyMember getMemberByName(final String name) - { - for (PartyMember member : members) - { - if (name.equals(member.getName())) + if (id == member.getMemberId()) { return member; } @@ -300,10 +283,10 @@ public List getMembers() public boolean isInParty() { - return partyId != null; + return partyId != 0; } - public void setPartyMemberAvatar(UUID memberID, BufferedImage image) + public void setPartyMemberAvatar(long memberID, BufferedImage image) { final PartyMember memberById = getMemberById(memberID); @@ -314,22 +297,15 @@ public void setPartyMemberAvatar(UUID memberID, BufferedImage image) } } - private static String cleanUsername(String username) + private static long passphraseToId(String passphrase) { - String s = Text.removeTags(JAGEX_PRINTABLE_CHAR_MATCHER.retainFrom(username)); - if (s.length() >= MAX_USERNAME_LEN) - { - s = s.substring(0, MAX_USERNAME_LEN); - } - return s; + return Hashing.sha256().hashBytes( + passphrase.getBytes(StandardCharsets.UTF_8) + ).asLong() & Long.MAX_VALUE; } - private static UUID passphraseToId(String passphrase) + private static long randomMemberId() { - return UUID.nameUUIDFromBytes( - Hashing.sha256().hashBytes( - passphrase.getBytes(StandardCharsets.UTF_8) - ).asBytes() - ); + return new Random().nextLong() & Long.MAX_VALUE; } } diff --git a/runelite-client/src/main/java/net/runelite/client/party/WSClient.java b/runelite-client/src/main/java/net/runelite/client/party/WSClient.java index 302ebcbcc5..a76ea0c596 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/WSClient.java +++ b/runelite-client/src/main/java/net/runelite/client/party/WSClient.java @@ -26,6 +26,8 @@ import com.google.gson.Gson; import com.google.gson.JsonParseException; +import com.google.protobuf.InvalidProtocolBufferException; +import java.io.InputStreamReader; import java.util.Collection; import java.util.HashSet; import java.util.Objects; @@ -37,8 +39,9 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.client.RuneLite; import net.runelite.client.eventbus.EventBus; -import net.runelite.client.party.messages.Handshake; -import net.runelite.client.party.messages.PartyMessage; +import net.runelite.client.party.events.UserJoin; +import net.runelite.client.party.events.UserPart; +import net.runelite.client.party.messages.PartyMemberMessage; import net.runelite.client.party.messages.WebsocketMessage; import okhttp3.HttpUrl; import okhttp3.OkHttpClient; @@ -46,6 +49,7 @@ import okhttp3.Response; import okhttp3.WebSocket; import okhttp3.WebSocketListener; +import okio.ByteString; @Slf4j @Singleton @@ -104,15 +108,13 @@ void connect() } Request request = new Request.Builder() - .url(runeliteWs) + .url(runeliteWs.newBuilder() + .addQueryParameter("sessionId", sessionId.toString()) + .build()) .header("User-Agent", RuneLite.USER_AGENT) .build(); webSocket = okHttpClient.newWebSocket(request, this); - - Handshake handshake = new Handshake(); - handshake.setSession(sessionId); - send(handshake); } boolean isOpen() @@ -136,7 +138,42 @@ public void unregisterMessage(final Class message) } } - public void send(WebsocketMessage message) + void join(long partyId, long memberId) + { + final Party.Join join = Party.Join.newBuilder() + .setPartyId(partyId) + .setMemberId(memberId) + .build(); + final Party.C2S c2s = Party.C2S.newBuilder() + .setJoin(join) + .build(); + send(c2s); + } + + void part() + { + final Party.Part part = Party.Part.newBuilder() + .build(); + final Party.C2S c2s = Party.C2S.newBuilder() + .setPart(part) + .build(); + send(c2s); + } + + void send(WebsocketMessage message) + { + log.debug("Sending: {}", message); + final String json = gson.toJson(message, WebsocketMessage.class); + final Party.Data data = Party.Data.newBuilder() + .setData(com.google.protobuf.ByteString.copyFromUtf8(json)) + .build(); + final Party.C2S c2s = Party.C2S.newBuilder() + .setData(data) + .build(); + send(c2s); + } + + private void send(Party.C2S message) { if (webSocket == null) { @@ -144,9 +181,7 @@ public void send(WebsocketMessage message) connect(); } - final String json = gson.toJson(message, WebsocketMessage.class); - webSocket.send(json); - log.debug("Sent: {}", json); + webSocket.send(ByteString.of(message.toByteArray())); } @Override @@ -165,28 +200,55 @@ public void onOpen(WebSocket webSocket, Response response) } @Override - public void onMessage(WebSocket webSocket, String text) + public void onMessage(WebSocket webSocket, ByteString bytes) { - final WebsocketMessage message; - + Party.S2C s2c; try { - message = gson.fromJson(text, WebsocketMessage.class); + s2c = Party.S2C.parseFrom(bytes.toByteArray()); } - catch (JsonParseException e) + catch (InvalidProtocolBufferException e) { log.debug("Failed to deserialize message", e); return; } - if (message.isParty() && !(message instanceof PartyMessage)) + switch (s2c.getMsgCase()) { - // spoofed message? - return; - } + case JOIN: + Party.UserJoin join = s2c.getJoin(); + UserJoin userJoin = new UserJoin(join.getPartyId(), join.getMemberId()); + log.debug("Got: {}", userJoin); + eventBus.post(userJoin); + break; + case PART: + Party.UserPart part = s2c.getPart(); + UserPart userPart = new UserPart(part.getMemberId()); + log.debug("Got: {}", userPart); + eventBus.post(userPart); + break; + case DATA: + Party.PartyData data = s2c.getData(); + final WebsocketMessage message; - log.debug("Got: {}", text); - eventBus.post(message); + try + { + message = gson.fromJson(new InputStreamReader(data.getData().newInput()), WebsocketMessage.class); + } + catch (JsonParseException e) + { + log.debug("Failed to deserialize message", e); + return; + } + + if (message instanceof PartyMemberMessage) + { + ((PartyMemberMessage) message).setMemberId(data.getMemberId()); + } + + log.debug("Got: {}", message); + eventBus.post(message); + } } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/party/WebsocketGsonFactory.java b/runelite-client/src/main/java/net/runelite/client/party/WebsocketGsonFactory.java index f88330636c..0a12348945 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/WebsocketGsonFactory.java +++ b/runelite-client/src/main/java/net/runelite/client/party/WebsocketGsonFactory.java @@ -29,29 +29,19 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import net.runelite.client.party.messages.Handshake; -import net.runelite.client.party.messages.Join; -import net.runelite.client.party.messages.Part; import net.runelite.client.party.messages.PartyChatMessage; -import net.runelite.client.party.messages.UserJoin; -import net.runelite.client.party.messages.UserPart; import net.runelite.client.party.messages.UserSync; import net.runelite.client.party.messages.WebsocketMessage; import net.runelite.client.util.RuntimeTypeAdapterFactory; import net.runelite.http.api.RuneLiteAPI; -public class WebsocketGsonFactory +class WebsocketGsonFactory { private static final Collection> MESSAGES; static { final List> messages = new ArrayList<>(); - messages.add(Handshake.class); - messages.add(Join.class); - messages.add(Part.class); - messages.add(UserJoin.class); - messages.add(UserPart.class); messages.add(UserSync.class); messages.add(PartyChatMessage.class); MESSAGES = messages; diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/UserJoin.java b/runelite-client/src/main/java/net/runelite/client/party/events/UserJoin.java similarity index 84% rename from runelite-client/src/main/java/net/runelite/client/party/messages/UserJoin.java rename to runelite-client/src/main/java/net/runelite/client/party/events/UserJoin.java index 2254f93fae..14849e37ed 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/UserJoin.java +++ b/runelite-client/src/main/java/net/runelite/client/party/events/UserJoin.java @@ -22,17 +22,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.client.party.messages; +package net.runelite.client.party.events; -import java.util.UUID; -import lombok.EqualsAndHashCode; import lombok.Value; @Value -@EqualsAndHashCode(callSuper = true) -public class UserJoin extends WebsocketMessage +public class UserJoin { - private final UUID memberId; - private final UUID partyId; - private final String name; + long partyId; + long memberId; } diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/UserPart.java b/runelite-client/src/main/java/net/runelite/client/party/events/UserPart.java similarity index 86% rename from runelite-client/src/main/java/net/runelite/client/party/messages/UserPart.java rename to runelite-client/src/main/java/net/runelite/client/party/events/UserPart.java index 2407db13d4..b3b3734278 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/UserPart.java +++ b/runelite-client/src/main/java/net/runelite/client/party/events/UserPart.java @@ -22,15 +22,12 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.client.party.messages; +package net.runelite.client.party.events; -import java.util.UUID; -import lombok.EqualsAndHashCode; import lombok.Value; @Value -@EqualsAndHashCode(callSuper = true) -public class UserPart extends WebsocketMessage +public class UserPart { - private final UUID memberId; + long memberId; } diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/Handshake.java b/runelite-client/src/main/java/net/runelite/client/party/messages/Handshake.java deleted file mode 100644 index ac9f9b9d3c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/Handshake.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.party.messages; - -import java.util.UUID; -import lombok.Data; - -@Data -public class Handshake extends WebsocketMessage -{ - private UUID session; -} diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/Join.java b/runelite-client/src/main/java/net/runelite/client/party/messages/Join.java deleted file mode 100644 index c63fa3ffae..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/Join.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.party.messages; - -import java.util.UUID; -import lombok.EqualsAndHashCode; -import lombok.Value; - -@Value -@EqualsAndHashCode(callSuper = true) -public class Join extends WebsocketMessage -{ - private final UUID partyId; - private final String name; -} diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/Part.java b/runelite-client/src/main/java/net/runelite/client/party/messages/Part.java deleted file mode 100644 index 53f903b160..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/Part.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.party.messages; - -public class Part extends WebsocketMessage -{ -} diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMemberMessage.java b/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMemberMessage.java index d706360484..bb02a521e0 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMemberMessage.java +++ b/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMemberMessage.java @@ -1,6 +1,5 @@ package net.runelite.client.party.messages; -import java.util.UUID; import lombok.Getter; import lombok.Setter; @@ -8,5 +7,5 @@ @Setter public abstract class PartyMemberMessage extends PartyMessage { - private UUID memberId; + private transient long memberId; } diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMessage.java b/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMessage.java index 58b2327fb4..f889072d71 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMessage.java +++ b/runelite-client/src/main/java/net/runelite/client/party/messages/PartyMessage.java @@ -26,8 +26,4 @@ public abstract class PartyMessage extends WebsocketMessage { - public PartyMessage() - { - _party = true; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/UserSync.java b/runelite-client/src/main/java/net/runelite/client/party/messages/UserSync.java index 6d06655e95..b4ed975af9 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/UserSync.java +++ b/runelite-client/src/main/java/net/runelite/client/party/messages/UserSync.java @@ -24,11 +24,6 @@ */ package net.runelite.client.party.messages; -import lombok.EqualsAndHashCode; -import lombok.Value; - -@Value -@EqualsAndHashCode(callSuper = true) public class UserSync extends PartyMemberMessage { } diff --git a/runelite-client/src/main/java/net/runelite/client/party/messages/WebsocketMessage.java b/runelite-client/src/main/java/net/runelite/client/party/messages/WebsocketMessage.java index 1685b58108..3f5fa792ce 100644 --- a/runelite-client/src/main/java/net/runelite/client/party/messages/WebsocketMessage.java +++ b/runelite-client/src/main/java/net/runelite/client/party/messages/WebsocketMessage.java @@ -24,12 +24,6 @@ */ package net.runelite.client.party.messages; -public class WebsocketMessage +public abstract class WebsocketMessage { - protected boolean _party; - - public boolean isParty() - { - return _party; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java index a7de70a68f..0cd2385e61 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/discord/DiscordPlugin.java @@ -280,7 +280,6 @@ public void onUserSync(final UserSync event) discordUser.discriminator, discordUser.avatar ); - userInfo.setMemberId(localMember.getMemberId()); partyService.send(userInfo); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 5a71ea0da8..7f808a8c1b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -198,7 +198,6 @@ public void onHitsplatApplied(HitsplatApplied hitsplatApplied) if (localMember != null) { final DpsUpdate dpsUpdate = new DpsUpdate(hit, isBoss); - dpsUpdate.setMemberId(localMember.getMemberId()); partyService.send(dpsUpdate); } @@ -235,7 +234,7 @@ else if (hitsplat.isOthers()) @Subscribe public void onDpsUpdate(DpsUpdate dpsUpdate) { - if (partyService.getLocalMember().getMemberId().equals(dpsUpdate.getMemberId())) + if (partyService.getLocalMember().getMemberId() == dpsUpdate.getMemberId()) { return; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyMemberBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyMemberBox.java index 53c6c8aab2..38ce7c92b7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyMemberBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyMemberBox.java @@ -38,6 +38,8 @@ import javax.swing.border.EmptyBorder; import lombok.AccessLevel; import lombok.Getter; +import net.runelite.client.party.PartyMember; +import net.runelite.client.party.PartyService; import net.runelite.client.plugins.party.data.PartyData; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.DynamicGridLayout; @@ -45,7 +47,6 @@ import net.runelite.client.ui.components.MouseDragEventForwarder; import net.runelite.client.ui.components.ProgressBar; import net.runelite.client.util.ImageUtil; -import net.runelite.client.party.PartyMember; class PartyMemberBox extends JPanel { @@ -56,6 +57,7 @@ class PartyMemberBox extends JPanel @Getter(AccessLevel.PACKAGE) private final PartyData memberPartyData; + private final PartyService partyService; private final ProgressBar hpBar = new ProgressBar(); private final ProgressBar prayerBar = new ProgressBar(); @@ -67,10 +69,12 @@ class PartyMemberBox extends JPanel private boolean avatarSet; - PartyMemberBox(final PartyConfig config, final JComponent panel, final PartyData memberPartyData) + PartyMemberBox(final PartyConfig config, final JComponent panel, final PartyData memberPartyData, + final PartyService partyService) { this.config = config; this.memberPartyData = memberPartyData; + this.partyService = partyService; setLayout(new BorderLayout()); setBorder(new EmptyBorder(5, 0, 0, 0)); @@ -137,7 +141,7 @@ class PartyMemberBox extends JPanel void update() { - final PartyMember member = memberPartyData.getMember(); + final PartyMember member = partyService.getMemberById(memberPartyData.getMemberId()); // Avatar if (!avatarSet && member.getAvatar() != null) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPanel.java index 1b293dc45d..5b110e33fd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPanel.java @@ -34,7 +34,6 @@ import java.awt.datatransfer.StringSelection; import java.util.HashMap; import java.util.Map; -import java.util.UUID; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComponent; @@ -42,12 +41,12 @@ import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import net.runelite.client.callback.ClientThread; +import net.runelite.client.party.PartyService; import net.runelite.client.plugins.party.data.PartyData; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.PluginPanel; import net.runelite.client.ui.components.DragAndDropReorderPane; import net.runelite.client.ui.components.PluginErrorPanel; -import net.runelite.client.party.PartyService; class PartyPanel extends PluginPanel { @@ -58,7 +57,7 @@ class PartyPanel extends PluginPanel private final PartyService party; private final PartyConfig config; - private final Map memberBoxes = new HashMap<>(); + private final Map memberBoxes = new HashMap<>(); private final JButton startButton = new JButton(); private final JButton joinPartyButton = new JButton(); @@ -216,10 +215,10 @@ else if (plugin.getPartyDataMap().size() <= 1) void addMember(PartyData partyData) { - if (!memberBoxes.containsKey(partyData.getMember().getMemberId())) + if (!memberBoxes.containsKey(partyData.getMemberId())) { - PartyMemberBox partyMemberBox = new PartyMemberBox(config, memberBoxPanel, partyData); - memberBoxes.put(partyData.getMember().getMemberId(), partyMemberBox); + PartyMemberBox partyMemberBox = new PartyMemberBox(config, memberBoxPanel, partyData, party); + memberBoxes.put(partyData.getMemberId(), partyMemberBox); memberBoxPanel.add(partyMemberBox); memberBoxPanel.revalidate(); } @@ -234,7 +233,7 @@ void removeAllMembers() updateParty(); } - void removeMember(UUID memberId) + void removeMember(long memberId) { final PartyMemberBox memberBox = memberBoxes.remove(memberId); @@ -247,7 +246,7 @@ void removeMember(UUID memberId) updateParty(); } - void updateMember(UUID userId) + void updateMember(long userId) { final PartyMemberBox memberBox = memberBoxes.get(userId); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java index 4f9f438d6c..1143c20978 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java @@ -36,7 +36,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Named; @@ -70,8 +69,8 @@ import net.runelite.client.party.PartyMember; import net.runelite.client.party.PartyService; import net.runelite.client.party.WSClient; -import net.runelite.client.party.messages.UserJoin; -import net.runelite.client.party.messages.UserPart; +import net.runelite.client.party.events.UserJoin; +import net.runelite.client.party.events.UserPart; import net.runelite.client.party.messages.UserSync; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -138,7 +137,7 @@ public class PartyPlugin extends Plugin boolean developerMode; @Getter - private final Map partyDataMap = Collections.synchronizedMap(new HashMap<>()); + private final Map partyDataMap = Collections.synchronizedMap(new HashMap<>()); @Getter private final List pendingTilePings = Collections.synchronizedList(new ArrayList<>()); @@ -295,7 +294,6 @@ public void onMenuOptionClicked(MenuOptionClicked event) event.consume(); final TilePing tilePing = new TilePing(selectedSceneTile.getWorldLocation()); - tilePing.setMemberId(party.getLocalMember().getMemberId()); party.send(tilePing); } @@ -355,7 +353,6 @@ public void shareLocation() lastLocation = location; final LocationUpdate locationUpdate = new LocationUpdate(location); - locationUpdate.setMemberId(localMember.getMemberId()); party.send(locationUpdate); } @@ -371,7 +368,6 @@ void requestSync() { // Request sync final UserSync userSync = new UserSync(); - userSync.setMemberId(party.getLocalMember().getMemberId()); party.send(userSync); } } @@ -380,28 +376,29 @@ void requestSync() public void onCharacterNameUpdate(final CharacterNameUpdate event) { final PartyData partyData = getPartyData(event.getMemberId()); - if (partyData == null) { return; } - final String name = Text.removeTags(Text.toJagexName(event.getCharacterName())); - final PartyMember member = partyData.getMember(); - - if (!name.isEmpty()) + final PartyMember member = party.getMemberById(event.getMemberId()); + if (member != null) { - member.setDisplayName(name); - member.setLoggedIn(true); - partyData.setColor(ColorUtil.fromObject(name)); - } - else - { - member.setLoggedIn(false); - partyData.setColor(Color.WHITE); + final String name = Text.removeTags(Text.toJagexName(event.getCharacterName())); + if (!name.isEmpty()) + { + member.setDisplayName(name); + member.setLoggedIn(true); + partyData.setColor(ColorUtil.fromObject(name)); + } + else + { + member.setLoggedIn(false); + partyData.setColor(Color.WHITE); + } } - SwingUtilities.invokeLater(() -> panel.updateMember(member.getMemberId())); + SwingUtilities.invokeLater(() -> panel.updateMember(event.getMemberId())); } @Subscribe @@ -425,7 +422,7 @@ else if (event.getSkill() == Skill.PRAYER) partyData.setMaxPrayer(event.getMax()); } - SwingUtilities.invokeLater(() -> panel.updateMember(partyData.getMember().getMemberId())); + SwingUtilities.invokeLater(() -> panel.updateMember(partyData.getMemberId())); } @Subscribe @@ -471,21 +468,18 @@ private void checkStateChanged(boolean forceSend) if (forceSend || currentHealth != lastHp) { final SkillUpdate update = new SkillUpdate(Skill.HITPOINTS, currentHealth, realHealth); - update.setMemberId(localMember.getMemberId()); party.send(update); } if (forceSend || currentPrayer != lastPray) { final SkillUpdate update = new SkillUpdate(Skill.PRAYER, currentPrayer, realPrayer); - update.setMemberId(localMember.getMemberId()); party.send(update); } if (forceSend || !characterName.equals(lastCharacterName)) { final CharacterNameUpdate update = new CharacterNameUpdate(characterName); - update.setMemberId(localMember.getMemberId()); party.send(update); } } @@ -536,7 +530,7 @@ public void onCommandExecuted(CommandExecuted commandExecuted) chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.GAMEMESSAGE).value("Local ID " + party.getLocalMember().getMemberId()).build()); for (PartyMember partyMember : party.getMembers()) { - chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.GAMEMESSAGE).value("Member " + partyMember.getName() + " " + partyMember.getDisplayName() + " " + partyMember.getMemberId()).build()); + chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.GAMEMESSAGE).value("Member " + partyMember.getDisplayName() + " " + partyMember.getMemberId()).build()); } } @@ -547,7 +541,7 @@ public void onPartyMemberAvatar(PartyMemberAvatar event) } @Nullable - PartyData getPartyData(final UUID uuid) + PartyData getPartyData(final long uuid) { final PartyMember memberById = party.getMemberById(uuid); @@ -573,7 +567,7 @@ PartyData getPartyData(final UUID uuid) worldMapManager.add(worldMapPoint); } - PartyData partyData = new PartyData(memberById, worldMapPoint); + PartyData partyData = new PartyData(uuid, worldMapPoint); SwingUtilities.invokeLater(() -> panel.addMember(partyData)); return partyData; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginService.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginService.java index 8f944eb833..afc8094851 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginService.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginService.java @@ -24,7 +24,6 @@ */ package net.runelite.client.plugins.party; -import java.util.UUID; import javax.annotation.Nullable; import net.runelite.client.plugins.party.data.PartyData; @@ -36,5 +35,5 @@ public interface PartyPluginService * @return party data for member */ @Nullable - PartyData getPartyData(UUID memberId); + PartyData getPartyData(long memberId); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginServiceImpl.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginServiceImpl.java index 042a5e7919..f597e5e72a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginServiceImpl.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPluginServiceImpl.java @@ -24,7 +24,6 @@ */ package net.runelite.client.plugins.party; -import java.util.UUID; import javax.inject.Inject; import javax.inject.Singleton; import net.runelite.client.plugins.party.data.PartyData; @@ -42,7 +41,7 @@ private PartyPluginServiceImpl(final PartyPlugin plugin) } @Override - public PartyData getPartyData(UUID memberId) + public PartyData getPartyData(long memberId) { return plugin.getPartyData(memberId); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyData.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyData.java index ee6279ce8a..0d9594d8c7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyData.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/data/PartyData.java @@ -31,14 +31,13 @@ import lombok.Setter; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; -import net.runelite.client.party.PartyMember; @Setter @Getter @RequiredArgsConstructor public class PartyData { - private final PartyMember member; + private final long memberId; private final WorldMapPoint worldMapPoint; private final PanelComponent panel = new PanelComponent(); private Color color = Color.WHITE; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java index 8762b8d726..eac37b250a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/messages/LocationUpdate.java @@ -24,14 +24,27 @@ */ package net.runelite.client.plugins.party.messages; -import lombok.EqualsAndHashCode; -import lombok.Value; +import lombok.ToString; import net.runelite.api.coords.WorldPoint; import net.runelite.client.party.messages.PartyMemberMessage; -@Value -@EqualsAndHashCode(callSuper = true) +@ToString(onlyExplicitlyIncluded = true) public class LocationUpdate extends PartyMemberMessage { - private final WorldPoint worldPoint; + private final int c; + + public LocationUpdate(WorldPoint worldPoint) + { + c = (worldPoint.getPlane() << 28) | (worldPoint.getX() << 14) | (worldPoint.getY()); + } + + @ToString.Include + public WorldPoint getWorldPoint() + { + return new WorldPoint( + (c >> 14) & 0x3fff, + c & 0x3fff, + (c >> 28) & 3 + ); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java index 0ed6652019..d569fea736 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/specialcounter/SpecialCounterPlugin.java @@ -314,7 +314,6 @@ public void onHitsplatApplied(HitsplatApplied hitsplatApplied) if (!party.getMembers().isEmpty()) { final SpecialCounterUpdate specialCounterUpdate = new SpecialCounterUpdate(npcIndex, specialWeapon, hit, client.getWorld(), localPlayerId); - specialCounterUpdate.setMemberId(party.getLocalMember().getMemberId()); party.send(specialCounterUpdate); } @@ -341,7 +340,7 @@ public void onNpcDespawned(NpcDespawned npcDespawned) @Subscribe public void onSpecialCounterUpdate(SpecialCounterUpdate event) { - if (party.getLocalMember().getMemberId().equals(event.getMemberId()) + if (party.getLocalMember().getMemberId() == event.getMemberId() || event.getWorld() != client.getWorld()) { return; diff --git a/runelite-client/src/main/resources/net/runelite/client/runelite.properties b/runelite-client/src/main/resources/net/runelite/client/runelite.properties index 892e84181f..cbd2939ba8 100644 --- a/runelite-client/src/main/resources/net/runelite/client/runelite.properties +++ b/runelite-client/src/main/resources/net/runelite/client/runelite.properties @@ -18,7 +18,7 @@ runelite.imgur.client.id=30d71e5f6860809 runelite.api.base=https://api.runelite.net/runelite-${project.version} runelite.session=https://api.runelite.net/session runelite.static.base=https://static.runelite.net -runelite.ws=https://api.runelite.net/ws +runelite.ws=https://api.runelite.net/ws2 runelite.config=https://static.runelite.net/config.json runelite.osrstwitter.link=https://twitter.com/OldSchoolRS runelite.oauth.redirect=https://runelite.net/logged-in \ No newline at end of file diff --git a/suppressions.xml b/suppressions.xml index efac9fd008..962c26ceb0 100644 --- a/suppressions.xml +++ b/suppressions.xml @@ -27,5 +27,6 @@ "-//Checkstyle//DTD SuppressionFilter Configuration 1.1//EN" "https://checkstyle.org/dtds/suppressions_1_1.dtd"> - + +