From 99258dfe2c8423bef66d8f4cb4ae31bdd921c5bc Mon Sep 17 00:00:00 2001 From: Isaac - The456 Date: Thu, 5 Sep 2024 15:18:52 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matouš Kučera --- docs/velocity/dev/api/plugin-messaging.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/velocity/dev/api/plugin-messaging.mdx b/docs/velocity/dev/api/plugin-messaging.mdx index 2b07eba8..3f9664b4 100644 --- a/docs/velocity/dev/api/plugin-messaging.mdx +++ b/docs/velocity/dev/api/plugin-messaging.mdx @@ -19,13 +19,13 @@ flowchart LR :::warning -When listening to PluginMessageEvent, ensure sure the result is +When listening to `PluginMessageEvent`, ensure the result is `ForwardResult.handled()` if you do not intend the client to participate. -If the result is forwarded, Players can spoof the proxy to your backends. +If the result is forwarded, players can impersonate the proxy to your backend servers. -Additionally, ensure the result is set correct after actually handling correct messages, to prevent them from being leaked to the other party. +Additionally, ensure the result is set correctly after actually handling correct messages, to prevent them from being leaked to the other party. This can be achieved with unconditionally setting the result between checking the identifier and checking the source, as shown in the examples. @@ -63,7 +63,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) { @Subscribe public void onPluginMessageFromPlayer(PluginMessageEvent event) { - // Check if Identifier matches first, no matter the source. + // Check if the identifier matches first, no matter the source. if (!IDENTIFIER.equals(event.getIdentifier())) { return; } @@ -75,7 +75,7 @@ public void onPluginMessageFromPlayer(PluginMessageEvent event) { // Alternatively: // mark PluginMessage as forwarded, indicating that the contents - // should be passed through, as if velocity is not present. + // should be passed through, as if Velocity is not present. //event.setResult(PluginMessageEvent.ForwardResult.forward()); // only attempt parsing the data if the source is a player @@ -173,7 +173,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) { @Subscribe public void onPluginMessageFromBackend(PluginMessageEvent event) { - // Check if Identifier matches first, no matter the source. + // Check if the identifier matches first, no matter the source. // this allows setting all messages to IDENTIFIER as handled, // preventing any client-originating messages from being forwarded. if (!IDENTIFIER.equals(event.getIdentifier())) {