Skip to content

Commit

Permalink
This should fix group messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainRexPL committed Jan 15, 2024
1 parent a8420ec commit 6a5201e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.collarmc.client.api.messaging;

import com.collarmc.api.groups.Group;
import com.collarmc.api.identity.ClientIdentity;
import com.collarmc.api.messaging.Message;
import com.collarmc.api.session.Player;
import com.collarmc.client.Collar;
Expand Down Expand Up @@ -95,14 +96,14 @@ public boolean handleResponse(ProtocolResponse resp) {
try {
byte[] contents = groupSession.decrypt(response.message, response.sender);
message = Utils.messagePackMapper().readValue(contents, Message.class);
} catch (IOException | CipherException e) {
// We don't throw an exception here in case someone is doing something naughty to disrupt the group and cause the client to exit
LOGGER.error(collar.identity() + "could not read group message from group " + group.id, e);
message = null;
}
if (message != null) {
collar.configuration.eventBus.dispatch(new GroupMessageReceivedEvent(collar, group, response.player, message));
}});
} catch (IOException | CipherException e) {
// We don't throw an exception here in case someone is doing something naughty to disrupt the group and cause the client to exit
LOGGER.error(collar.identity() + "could not read group message from group " + group.id, e);
message = null;
}
if (message != null) {
collar.configuration.eventBus.dispatch(new GroupMessageReceivedEvent(collar, group, new Player((ClientIdentity)response.sender, null), message));
}});
});
} else if (response.sender != null) {
Message message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.collarmc.api.minecraft.MinecraftPlayer;

/**
* Fired when a private message was attempted with another player but there was not sufficent trust to deliver
* Fired when a private message was attempted with another player but there was not sufficient trust to deliver
*/
public final class UntrustedPrivateMessageReceivedEvent extends AbstractCollarEvent {
public final MinecraftPlayer player;
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -179,7 +179,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.0-jre</version>
<version>31.1-jre</version>
</dependency>
<!-- if someone wants to rewrite and use org.json like a chump be my guest -->
<dependency>
Expand Down

0 comments on commit 6a5201e

Please sign in to comment.