I need to create a new fake instance of IPlayer (With the name of "Server Console")
But opcause just doing new IPlayer() doesn't work becuse of it being an interface and all so what class chould be an IPlayer?
I need to create a new fake instance of IPlayer (With the name of "Server Console")
But opcause just doing new IPlayer() doesn't work becuse of it being an interface and all so what class chould be an IPlayer?
public class IPlayerConsole : IPlayer
{
public object Object { set; get; }
public CommandType LastCommand { set; get; } = CommandType.Console;
public string Name { set; get; } = "Server Console";
public string Id { set; get; } = "server_console";
public string Address { set; get; } = "server_console";
public int Ping { set; get; } = -1;
public CultureInfo Language { set; get; } = null;
public bool IsConnected { set; get; } = false;
public bool IsSleeping { set; get; } = true;
public bool IsServer { set; get; } = true;
public bool IsAdmin { set; get; } = true;
public bool IsBanned { set; get; } = false;
public TimeSpan BanTimeRemaining { set; get; } = new TimeSpan(0, 0, 0);
public float Health { set; get; } = 0;
public float MaxHealth { set; get; } = 100;
public void AddToGroup(string group)
{
}
public void Ban(string reason, TimeSpan duration = default(TimeSpan))
{
}
public bool BelongsToGroup(string group)
{
return false;
}
public void Command(string command, params object[] args)
{
}
public void GrantPermission(string perm)
{
}
public bool HasPermission(string perm)
{
return true;
}
public void Heal(float amount)
{
}
public void Hurt(float amount)
{
}
public void Kick(string reason)
{
}
public void Kill()
{
}
public void Message(string message, string prefix, params object[] args)
{
}
public void Message(string message)
{
}
public void Position(out float x, out float y, out float z)
{
x = 0;
y = 0;
z = 0;
}
public GenericPosition Position()
{
return new GenericPosition(0, 0, 0);
}
public void RemoveFromGroup(string group)
{
}
public void Rename(string name)
{
}
public void Reply(string message, string prefix, params object[] args)
{
;
}
public void Reply(string message)
{
}
public void RevokePermission(string perm)
{
}
public void Teleport(float x, float y, float z)
{
}
public void Teleport(GenericPosition pos)
{
}
public void Unban()
{
}
} In response to Wulf ():Question still stands: why do you need to do this?
public IPlayer BetterGetPlayerById(string id)
{
if (id == "server_console")
{
return new tacti.IPlayerConsole();
}
return players.FindPlayerById(id);
}