From 90cd7c8fc37eecb5b1674c7745be39008f846272 Mon Sep 17 00:00:00 2001 From: CaptainRexPL Date: Mon, 15 Jan 2024 11:17:44 +0100 Subject: [PATCH] Fix group messaging --- client/pom.xml | 22 +++++++-------- .../client/api/messaging/MessagingApi.java | 17 +++++------ .../UntrustedPrivateMessageReceivedEvent.java | 2 +- pom.xml | 28 +++++++++---------- server/pom.xml | 4 +-- shared/pom.xml | 12 ++++---- tests/pom.xml | 2 +- 7 files changed, 44 insertions(+), 43 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index 9762af2d..dee13bad 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -28,7 +28,7 @@ io.netty netty-all - 4.1.92.Final + 4.1.104.Final compile @@ -73,13 +73,13 @@ - - com.google.guava:guava - org.apache.logging.log4j:* - com.google.code.findbugs:* - net.jcip:jcip-annotations:* - net.java.dev.jna:* - + + com.google.guava:guava + org.apache.logging.log4j:* + com.google.code.findbugs:* + net.jcip:jcip-annotations:* + net.java.dev.jna:* + @@ -160,7 +160,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.3.0 + 3.4.1 enforce-bytecode-version @@ -182,10 +182,10 @@ org.codehaus.mojo extra-enforcer-rules - 1.6.2 + 1.7.0 - + \ No newline at end of file diff --git a/client/src/main/java/com/collarmc/client/api/messaging/MessagingApi.java b/client/src/main/java/com/collarmc/client/api/messaging/MessagingApi.java index 43800ef8..c20d4e29 100644 --- a/client/src/main/java/com/collarmc/client/api/messaging/MessagingApi.java +++ b/client/src/main/java/com/collarmc/client/api/messaging/MessagingApi.java @@ -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; @@ -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; diff --git a/client/src/main/java/com/collarmc/client/api/messaging/events/UntrustedPrivateMessageReceivedEvent.java b/client/src/main/java/com/collarmc/client/api/messaging/events/UntrustedPrivateMessageReceivedEvent.java index 7f2d2fb9..a141c03b 100644 --- a/client/src/main/java/com/collarmc/client/api/messaging/events/UntrustedPrivateMessageReceivedEvent.java +++ b/client/src/main/java/com/collarmc/client/api/messaging/events/UntrustedPrivateMessageReceivedEvent.java @@ -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; diff --git a/pom.xml b/pom.xml index 812692e6..e2737080 100644 --- a/pom.xml +++ b/pom.xml @@ -27,11 +27,11 @@ true 16 16 - 2.15.0 + 2.16.1 UTF-8 UTF-8 16 - 2.20.0 + 2.22.1 @@ -39,7 +39,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.3.0 + 3.4.1 enforce-banned-dependencies @@ -67,7 +67,7 @@ org.jacoco jacoco-maven-plugin - 0.8.10 + 0.8.11 @@ -103,7 +103,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.12.1 16 16 @@ -112,7 +112,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0 + 3.2.5 org.apache.maven.plugins @@ -126,7 +126,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 + 3.5.1 @@ -179,7 +179,7 @@ com.google.guava guava - 32.0.0-jre + 33.0.0-jre @@ -200,19 +200,19 @@ io.netty netty-all - 4.1.92.Final + 4.1.104.Final compile org.mongodb mongodb-driver-sync - 4.9.1 + 4.11.1 net.java.dev.jna jna - 5.13.0 + 5.14.0 @@ -239,12 +239,12 @@ org.glassfish.jersey.core jersey-client - 3.1.1 + 3.1.5 org.apache.commons commons-lang3 - 3.12.0 + 3.14.0 com.google.code.findbugs @@ -254,7 +254,7 @@ commons-validator commons-validator - 1.7 + 1.8.0 org.apache.logging.log4j diff --git a/server/pom.xml b/server/pom.xml index 3d941a93..5e50529d 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -119,7 +119,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.4.1 + 3.5.1 package @@ -162,4 +162,4 @@ - + \ No newline at end of file diff --git a/shared/pom.xml b/shared/pom.xml index 396d0556..4df655fd 100644 --- a/shared/pom.xml +++ b/shared/pom.xml @@ -22,7 +22,7 @@ net.java.dev.jna jna - 5.13.0 + 5.14.0 com.fasterxml.jackson.core @@ -40,10 +40,10 @@ com.google.guava guava - + io.netty netty-all - 4.1.92.Final + 4.1.104.Final compile @@ -69,7 +69,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.3.0 + 3.4.1 enforce-bytecode-version @@ -91,10 +91,10 @@ org.codehaus.mojo extra-enforcer-rules - 1.6.2 + 1.7.0 - + \ No newline at end of file diff --git a/tests/pom.xml b/tests/pom.xml index a0cfee9d..f215acfa 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -43,7 +43,7 @@ org.jacoco jacoco-maven-plugin - 0.8.10 + 0.8.11 report