/// <inheritdoc /> public void Execute(ICommandContext context) { if (context.Parameters.Length == 0) { throw new CommandWrongUsageException(); } IPlayerManager playerManager = context.Container.Resolve <IPlayerManager>("eco"); IUserInfo userInfo; if (playerManager.TryGetOnlinePlayer(context.Parameters[0], out IPlayer onlinePlayer)) { userInfo = ((EcoPlayer)onlinePlayer).User; } else { IPlayer player = playerManager.GetPlayer(context.Parameters[0]); switch (player) { case EcoPlayer ecoPlayer: userInfo = ecoPlayer.User; break; default: throw new InvalidOperationException("Eco's IPlayerManager returned an invalid player! This can only happen if a plugin overrides it."); } } string reason = null; if (context.Parameters.Length > 1) { reason = string.Join(" ", context.Parameters.Skip(1)); } playerManager.Ban(userInfo, context.User, reason); context.User.SendMessage("The requested user has been banned."); }