From 59efec128d10a449f8d75d136b46abc7047817b5 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 12 Mar 2013 11:38:11 +1100 Subject: [PATCH] Add ProxiedPlayer.chat, see #146 --- .../java/net/md_5/bungee/api/connection/ProxiedPlayer.java | 7 +++++++ proxy/src/main/java/net/md_5/bungee/UserConnection.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java index b0e45598..dd029e4e 100644 --- a/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java +++ b/api/src/main/java/net/md_5/bungee/api/connection/ProxiedPlayer.java @@ -62,4 +62,11 @@ public interface ProxiedPlayer extends Connection, CommandSender * @return the pending connection that this player used */ public PendingConnection getPendingConnection(); + + /** + * Make this player chat (say something), to the server he is currently on. + * + * @param message the message to say + */ + public void chat(String message); } diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index be29988a..79589cb8 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -160,6 +160,13 @@ public final class UserConnection implements ProxiedPlayer } } + @Override + public void chat(String message) + { + Preconditions.checkState( server != null, "Not connected to server" ); + server.getCh().write( new Packet3Chat( message ) ); + } + @Override public void sendMessage(String message) {