From f341d8d29ab2eb13d5e92d8e28fb7e0bba9f747e Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sat, 17 Oct 2020 17:42:40 +1100 Subject: [PATCH] #556: Allow sending messages from specific UUIDs By: Mariell Hoversholm --- .../java/org/bukkit/command/CommandSender.java | 18 ++++++++++++++++++ .../org/bukkit/conversations/Conversable.java | 10 ++++++++++ .../bukkit/conversations/FakeConversable.java | 8 ++++++++ 3 files changed, 36 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/command/CommandSender.java b/paper-api/src/main/java/org/bukkit/command/CommandSender.java index d247b0d8e2..b76cf67b12 100644 --- a/paper-api/src/main/java/org/bukkit/command/CommandSender.java +++ b/paper-api/src/main/java/org/bukkit/command/CommandSender.java @@ -1,8 +1,10 @@ package org.bukkit.command; +import java.util.UUID; import org.bukkit.Server; import org.bukkit.permissions.Permissible; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public interface CommandSender extends Permissible { @@ -20,6 +22,22 @@ public interface CommandSender extends Permissible { */ public void sendMessage(@NotNull String[] messages); + /** + * Sends this sender a message + * + * @param message Message to be displayed + * @param sender The sender of this message + */ + public void sendMessage(@Nullable UUID sender, @NotNull String message); + + /** + * Sends this sender multiple messages + * + * @param messages An array of messages to be displayed + * @param sender The sender of this message + */ + public void sendMessage(@Nullable UUID sender, @NotNull String[] messages); + /** * Returns the server instance that this command is running on * diff --git a/paper-api/src/main/java/org/bukkit/conversations/Conversable.java b/paper-api/src/main/java/org/bukkit/conversations/Conversable.java index 914c6388ec..b7d8dd3036 100644 --- a/paper-api/src/main/java/org/bukkit/conversations/Conversable.java +++ b/paper-api/src/main/java/org/bukkit/conversations/Conversable.java @@ -1,6 +1,8 @@ package org.bukkit.conversations; +import java.util.UUID; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * The Conversable interface is used to indicate objects that can have @@ -54,4 +56,12 @@ public interface Conversable { * @param message Message to be displayed */ public void sendRawMessage(@NotNull String message); + + /** + * Sends this sender a message raw + * + * @param message Message to be displayed + * @param sender The sender of this message + */ + public void sendRawMessage(@Nullable UUID sender, @NotNull String message); } diff --git a/paper-api/src/test/java/org/bukkit/conversations/FakeConversable.java b/paper-api/src/test/java/org/bukkit/conversations/FakeConversable.java index 1e6b48c772..567bfd7d3e 100644 --- a/paper-api/src/test/java/org/bukkit/conversations/FakeConversable.java +++ b/paper-api/src/test/java/org/bukkit/conversations/FakeConversable.java @@ -1,11 +1,14 @@ package org.bukkit.conversations; import java.util.Set; +import java.util.UUID; import org.bukkit.Server; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.Plugin; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** */ @@ -48,6 +51,11 @@ public class FakeConversable implements Conversable { lastSentMessage = message; } + @Override + public void sendRawMessage(@Nullable UUID sender, @NotNull String message) { + this.sendRawMessage(message); + } + public Server getServer() { return null; }