ProxyServer#broadcast()

This commit is contained in:
Andrew Steinborn
2018-09-20 22:43:58 -04:00
parent 0e901e2843
commit d06028e0f8
2 changed files with 16 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ import com.velocitypowered.proxy.network.ConnectionManager;
import com.velocitypowered.proxy.network.http.NettyHttpClient;
import com.velocitypowered.proxy.plugin.VelocityEventManager;
import com.velocitypowered.proxy.plugin.VelocityPluginManager;
import com.velocitypowered.proxy.protocol.packet.Chat;
import com.velocitypowered.proxy.protocol.util.FaviconSerializer;
import com.velocitypowered.proxy.scheduler.VelocityScheduler;
import com.velocitypowered.proxy.server.ServerMap;
@@ -253,6 +254,14 @@ public class VelocityServer implements ProxyServer {
return Optional.ofNullable(connectionsByUuid.get(uuid));
}
@Override
public void broadcast(Component component) {
Chat chat = Chat.createClientbound(component);
for (ConnectedPlayer player : connectionsByUuid.values()) {
player.getConnection().write(chat);
}
}
@Override
public Collection<Player> getAllPlayers() {
return ImmutableList.copyOf(connectionsByUuid.values());