using System; using System.Collections.Generic; using StardewValley; namespace StardewModdingAPI { /// Provides multiplayer utilities. public interface IMultiplayerHelper : IModLinked { /// Get a new multiplayer ID. long GetNewID(); /// Get the locations which are being actively synced from the host. IEnumerable GetActiveLocations(); /// Get a connected player. /// The player's unique ID. /// Returns the connected player, or null if no such player is connected. IMultiplayerPeer GetConnectedPlayer(long id); /// Get all connected players. IEnumerable GetConnectedPlayers(); /// Send a message to mods installed by connected players. /// The data type. This can be a class with a default constructor, or a value type. /// The data to send over the network. /// A message type which receiving mods can use to decide whether it's the one they want to handle, like SetPlayerLocation. This doesn't need to be globally unique, since mods should check the originating mod ID. /// The mod IDs which should receive the message on the destination computers, or null for all mods. Specifying mod IDs is recommended to improve performance, unless it's a general-purpose broadcast. /// The values for the players who should receive the message, or null for all players. If you don't need to broadcast to all players, specifying player IDs is recommended to reduce latency. /// The or is null. void SendMessage(TMessage message, string messageType, string[] modIDs = null, long[] playerIDs = null); } }