Class OpenPlayerManager
Holds all player's connected to the OpenServer instance.
Inheritance
System.Object
OpenPlayerManager
Implements
Namespace: OpenAPI.Player
Assembly: OpenAPI.dll
Syntax
public class OpenPlayerManager : PlayerFactory, IEventHandler
Constructors
| Improve this Doc View SourceOpenPlayerManager(OpenApi)
Creates a new instance of the OpenPlayerManager
Declaration
public OpenPlayerManager(OpenApi plugin)
Parameters
Type | Name | Description |
---|---|---|
OpenApi | plugin |
Methods
| Improve this Doc View SourceAddPlayer(PlayerJoinEvent)
Declaration
public void AddPlayer(PlayerJoinEvent e)
Parameters
Type | Name | Description |
---|---|---|
PlayerJoinEvent | e |
CreatePlayer(MiNetServer, IPEndPoint, PlayerInfo)
Declaration
public override MiNET.Player CreatePlayer(MiNetServer server, IPEndPoint endPoint, PlayerInfo playerInfo)
Parameters
Type | Name | Description |
---|---|---|
MiNetServer | server | |
IPEndPoint | endPoint | |
PlayerInfo | playerInfo |
Returns
Type | Description |
---|---|
MiNET.Player |
GetPlayers()
Get an array of currently connected players
Declaration
public OpenPlayer[] GetPlayers()
Returns
Type | Description |
---|---|
OpenPlayer[] | A list of Players |
RemovePlayer(PlayerQuitEvent)
Declaration
public void RemovePlayer(PlayerQuitEvent e)
Parameters
Type | Name | Description |
---|---|---|
PlayerQuitEvent | e |
TryGetPlayer(String, out OpenPlayer, StringComparison)
Get a player by username
Declaration
public bool TryGetPlayer(string name, out OpenPlayer player, StringComparison stringComparison = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The username to lookup |
OpenPlayer | player | If a match was found, returns the best match. Otherwise returns null. |
StringComparison | stringComparison | The string comparison mode to use, defaults to InvariantCultureIgnoreCase |
Returns
Type | Description |
---|---|
System.Boolean | True if a player was found |
TryGetPlayers(String, out OpenPlayer[], StringComparison)
Get's an array of players based on their username
Declaration
public bool TryGetPlayers(string name, out OpenPlayer[] player, StringComparison stringComparison = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The username to lookup |
OpenPlayer[] | player | If a match was found, returns a list of matches. Otherwise returns null. |
StringComparison | stringComparison | The string comparison mode to use, defaults to InvariantCultureIgnoreCase |
Returns
Type | Description |
---|---|
System.Boolean |