Basic framework - server loader, plugin manager, chat interface
This commit is contained in:
19
Piston/MyPlayerCollectionExtensions.cs
Normal file
19
Piston/MyPlayerCollectionExtensions.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Sandbox.Game.Multiplayer;
|
||||
using Sandbox.Game.World;
|
||||
|
||||
namespace Piston
|
||||
{
|
||||
public static class MyPlayerCollectionExtensions
|
||||
{
|
||||
public static MyPlayer TryGetPlayerBySteamId(this MyPlayerCollection collection, ulong steamId)
|
||||
{
|
||||
var id = collection.GetAllPlayers().FirstOrDefault(x => x.SteamId == steamId);
|
||||
return id == default(MyPlayer.PlayerId) ? null : collection.GetPlayerById(id);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user