From 3fdacd30d167dfbade07a33e7234c38aa99f2fbc Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Thu, 6 May 2021 16:43:40 -0400 Subject: [PATCH] Explain why Player#sendPluginMessage may not do what some people think it ought to do --- .../java/com/velocitypowered/api/proxy/Player.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/Player.java b/api/src/main/java/com/velocitypowered/api/proxy/Player.java index d03e532b7..de31ae71d 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/Player.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/Player.java @@ -9,6 +9,7 @@ package com.velocitypowered.api.proxy; import com.velocitypowered.api.command.CommandSource; import com.velocitypowered.api.event.player.PlayerResourcePackStatusEvent; +import com.velocitypowered.api.proxy.messages.ChannelIdentifier; import com.velocitypowered.api.proxy.messages.ChannelMessageSink; import com.velocitypowered.api.proxy.messages.ChannelMessageSource; import com.velocitypowered.api.proxy.player.PlayerSettings; @@ -226,4 +227,16 @@ public interface Player extends CommandSource, Identified, InboundConnection, * @param hash the SHA-1 hash value for the resource pack */ void sendResourcePack(String url, byte[] hash); + + /** + * @inheritDoc + * + * Note that this method does not send a plugin message to the server the player + * is connected to. You should only use this method if you are trying to communicate + * with a mod that is installed on the player's client. To send a plugin message to the server + * from the player, you should use the equivalent method on the instance returned by + * {@link #getCurrentServer()}. + */ + @Override + boolean sendPluginMessage(ChannelIdentifier identifier, byte[] data); }