13
0
geforkt von Mirrors/Paper

#759: Allow sending messages from specific UUIDs

By: Mariell Hoversholm <proximyst@proximyst.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2020-10-17 17:43:03 +11:00
Ursprung 071360817a
Commit b643889355
5 geänderte Dateien mit 61 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.command;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.conversations.Conversation;
@ -28,6 +29,11 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co
System.out.println(ChatColor.stripColor(message));
}
@Override
public void sendRawMessage(UUID sender, String message) {
this.sendRawMessage(message); // Console doesn't know of senders
}
@Override
public void sendMessage(String[] messages) {
for (String message : messages) {

Datei anzeigen

@ -2,6 +2,7 @@
package org.bukkit.craftbukkit.command;
import java.util.Set;
import java.util.UUID;
import net.minecraft.server.CommandListenerWrapper;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -47,6 +48,16 @@ public class ProxiedNativeCommandSender implements ProxiedCommandSender {
getCaller().sendMessage(messages);
}
@Override
public void sendMessage(UUID sender, String message) {
getCaller().sendMessage(sender, message);
}
@Override
public void sendMessage(UUID sender, String[] messages) {
getCaller().sendMessage(sender, messages);
}
@Override
public Server getServer() {
return getCallee().getServer();

Datei anzeigen

@ -1,6 +1,7 @@
package org.bukkit.craftbukkit.command;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -79,4 +80,14 @@ public abstract class ServerCommandSender implements CommandSender {
public Server getServer() {
return Bukkit.getServer();
}
@Override
public void sendMessage(UUID uuid, String message) {
this.sendMessage(message); // ServerCommandSenders have no use for senders
}
@Override
public void sendMessage(UUID uuid, String[] messages) {
this.sendMessage(messages); // ServerCommandSenders have no use for senders
}
}

Datei anzeigen

@ -793,6 +793,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
@Override
public void sendMessage(UUID sender, String message) {
this.sendMessage(message); // Most entities don't know about senders
}
@Override
public void sendMessage(UUID sender, String[] messages) {
this.sendMessage(messages); // Most entities don't know about senders
}
@Override
public String getName() {
return CraftChatMessage.fromComponent(getHandle().getDisplayName());

Datei anzeigen

@ -199,6 +199,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
@Override
public void sendRawMessage(UUID sender, String message) {
if (getHandle().playerConnection == null) return;
for (IChatBaseComponent component : CraftChatMessage.fromString(message)) {
getHandle().playerConnection.sendPacket(new PacketPlayOutChat(component, ChatMessageType.CHAT, (sender == null) ? SystemUtils.b : sender));
}
}
@Override
public void sendMessage(String message) {
if (!conversationTracker.isConversingModaly()) {
@ -213,6 +222,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
}
@Override
public void sendMessage(UUID sender, String message) {
if (!conversationTracker.isConversingModaly()) {
this.sendRawMessage(sender, message);
}
}
@Override
public void sendMessage(UUID sender, String[] messages) {
for (String message : messages) {
sendMessage(sender, message);
}
}
@Override
public String getDisplayName() {
return getHandle().displayName;