Skip to content

Commit

Permalink
Merge pull request #85 from Eastrall/feature/NetServerGetUser
Browse files Browse the repository at this point in the history
Add GetUser to INetServer
  • Loading branch information
Filipe GP authored Mar 16, 2018
2 parents 630c638 + 3406b10 commit cbe4387
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Ether.Network/Server/INetServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,12 @@ public interface INetServer : IDisposable
/// </summary>
/// <param name="packet">Packet to send.</param>
void SendToAll(INetPacketStream packet);

/// <summary>
/// Gets the user by his Id.
/// </summary>
/// <param name="id">User Id</param>
/// <returns>User</returns>
INetUser GetUser(Guid id);
}
}
3 changes: 3 additions & 0 deletions src/Ether.Network/Server/NetServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ public void SendTo(IEnumerable<INetUser> users, INetPacketStream packet)
/// <inheritdoc />
public void SendToAll(INetPacketStream packet) => this.SendTo(this.Clients, packet);

/// <inheritdoc />
public INetUser GetUser(Guid id) => this._clients.ContainsKey(id) ? this._clients[id] : null;

/// <summary>
/// Initialize the server resourrces.
/// </summary>
Expand Down

0 comments on commit cbe4387

Please sign in to comment.